lona-web-org / lona

Write responsive web apps in full python
MIT License
526 stars 27 forks source link

Browser back button not working in Firefox #550

Closed m-reichle closed 5 months ago

m-reichle commented 5 months ago

Hi,

I'm currently looking into an issue where the browser's back button does not work as expected when accessing Lona views using the Firefox browser. It works as expected when using Chrome/-ium but only seems to create a reload in Firefox.

Has anyone observed the same problem and/or found a way to solve it? I'm mostly puzzled by this only occurring in one browser.

fscherf commented 5 months ago

Hi @m-reichle! Interesting! Do I have to do something specific to trigger your problem? Do you have a reproducer for me?

m-reichle commented 5 months ago

Sure!

  1. Start any lona App. I just use the example.py from https://lona-web.org/1.x/tutorial/01-getting-started/index.html#hello-world
  2. Open a browser, go to lona-web.org (or any other site)
  3. Paste http://localhost:8080 into the browser's address bar, press Enter, see Hello World view
  4. Click the browser's Back button

This will take me back to lona-web.org on Chrome, but reload the view on Firefox.

fscherf commented 5 months ago

Hi @m-reichle. I can reproduce the problem and it is a bug for sure. The history behavior is wrong, but both browsers behave the same for me. I debugged it already, and I think the problem is that I invoke pushState too often. So the history is actually "correct", but I add too many entries to it. I hope to have a solution ready this week.

Thanks for reporting! :)

fscherf commented 5 months ago

@m-reichle: can you check if #552 fixes your issue?

m-reichle commented 5 months ago

Hi,

I've tested it both with my test case and our in-house application and it seems to have fixed the issue. Thank you for taking care of this!

fscherf commented 5 months ago

@m-reichle: Great! Thanks for testing :) No problem.

I will cleanup the PR a bit and merge it afterwards. I assume you need a release right?

fscherf commented 5 months ago

@m-reichle: The fix is available in 1.16.2. Thanks for contributing :)

m-reichle commented 4 months ago

Awesome! Thanks a lot!!