Skip to content

Commit

Permalink
WIP: fix some stack bug
Browse files Browse the repository at this point in the history
found this in my git stash. I think this fixes a bug.
  • Loading branch information
mixmasala committed Jul 30, 2024
1 parent 710adb1 commit a02ef14
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions katzen.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ func (a *App) Layout(gtx layout.Context) {
}

func (a *App) update(gtx layout.Context) {
if a.stack.Len() == 0 {
a.stack.Push(newSignInPage(a))
return
}

page := a.stack.Current()
if e := page.Event(gtx); e != nil {
switch e := e.(type) {
Expand Down
3 changes: 3 additions & 0 deletions stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ func (s *pageStack) Pop() {
s.pages[i] = nil
s.pages = s.pages[:i]
}
if len(s.pages) > 0 {
s.start() // start new top of stack
}
}

func (s *pageStack) start() {
Expand Down

0 comments on commit a02ef14

Please sign in to comment.