This commit is contained in:
Andrey Parhomenko 2023-09-25 19:27:25 +03:00
parent 3913979bc9
commit ce93a54cfa
2 changed files with 10 additions and 1 deletions

View file

@ -90,8 +90,13 @@ func (p *Page) Filter(
} }
func (p *Page) Serve(c *Context) { func (p *Page) Serve(c *Context) {
pth := c.Path()
if p.Action != nil { if p.Action != nil {
c.Run(p.Action, c.Update) c.Run(p.Action, c.Update)
if pth != c.Path() {
// If we went somewhere else then do nothing.
return
}
} }
msgs, _ := c.Render(p) msgs, _ := c.Render(p)
inlineMsg := msgs["page/inline"] inlineMsg := msgs["page/inline"]

View file

@ -221,5 +221,9 @@ func (c *Context) ReadString(pref string, args ...any) string {
// Change screen to the previous. // Change screen to the previous.
// To get to the parent screen use GoUp. // To get to the parent screen use GoUp.
func (c *Context) GoPrev() { func (c *Context) GoPrev() {
c.Go(c.PrevPath()) pth := c.PrevPath()
if pth == "" {
c.Go("/")
}
c.Go(pth)
} }