From ce93a54cfa79803d7e56b5a78dbe96452ec69388 Mon Sep 17 00:00:00 2001 From: surdeus Date: Mon, 25 Sep 2023 19:27:25 +0300 Subject: [PATCH] ... --- tg/page.go | 5 +++++ tg/private.go | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tg/page.go b/tg/page.go index bfd687c..ea8acef 100644 --- a/tg/page.go +++ b/tg/page.go @@ -90,8 +90,13 @@ func (p *Page) Filter( } func (p *Page) Serve(c *Context) { + pth := c.Path() if p.Action != nil { c.Run(p.Action, c.Update) + if pth != c.Path() { + // If we went somewhere else then do nothing. + return + } } msgs, _ := c.Render(p) inlineMsg := msgs["page/inline"] diff --git a/tg/private.go b/tg/private.go index 9148c56..2893c11 100644 --- a/tg/private.go +++ b/tg/private.go @@ -221,5 +221,9 @@ func (c *Context) ReadString(pref string, args ...any) string { // Change screen to the previous. // To get to the parent screen use GoUp. func (c *Context) GoPrev() { - c.Go(c.PrevPath()) + pth := c.PrevPath() + if pth == "" { + c.Go("/") + } + c.Go(pth) }