backstack: reimplemented the backstack
This is a much cleaner implementation.
This commit is contained in:
parent
ec9ac34d26
commit
6c5787b271
3 changed files with 55 additions and 49 deletions
|
|
@ -47,9 +47,8 @@ func (s *ViewSnapshotService) PopSnapshot() (*serialisable.ViewSnapshot, error)
|
|||
vs, err := s.store.Head()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "cannot get snapshot head")
|
||||
}
|
||||
if vs == nil {
|
||||
return vs, nil
|
||||
} else if vs == nil || vs.BackLink == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if err := s.store.SetAsHead(vs.BackLink); err != nil {
|
||||
|
|
@ -59,5 +58,12 @@ func (s *ViewSnapshotService) PopSnapshot() (*serialisable.ViewSnapshot, error)
|
|||
return nil, errors.Wrap(err, "cannot remove old ID")
|
||||
}
|
||||
|
||||
vs, err = s.store.Head()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "cannot get snapshot head")
|
||||
} else if vs == nil || vs.BackLink == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return vs, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue