Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix browser history #552

Merged
merged 3 commits into from
Mar 21, 2024
Merged

fix browser history #552

merged 3 commits into from
Mar 21, 2024

Conversation

fscherf
Copy link
Member

@fscherf fscherf commented Mar 18, 2024

Fixes #550

@rschwebel
Copy link

Is it intended that the patches still have a WIP: subject?

Copy link

@rschwebel rschwebel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some reasoning why the playwright version needs to be downgraded? Makes it easier in the future to find out if the reason is still valid.

@fscherf
Copy link
Member Author

fscherf commented Mar 19, 2024

Hi @rschwebel! As you correctly pointed out, the patches are not cleaned up yet and won't be merged in this state. I wanted some early feedback from @m-reichle if my changes fix her problem (or I suppose yours, for that matter :) ). Also I wanted to check wether the test works in CI.

While working on this, I had a lot of trouble running the browser tests locally. All calls to Playwrights page.wait_for_url('/') timeout for me and result in an InvalidStateError. It seems to be a regression because downgrading helped.
I am not sure yet what to do here and if this patch will on this PR. I will try to debug it further and report my findings to Playwright upstream if necessary.

The naming in the test modules is used to enforce a specific order of the tests
`tests/test_0305_requests.py` clashed with `tests/test_0305_events.py`.

Signed-off-by: Florian Scherf <mail@florianscherf.de>
Signed-off-by: Florian Scherf <mail@florianscherf.de>
The browser history of the client never *really* worked. When you were
redirected to a Lona app from an external site, you couldn't go back by
clicking on the back button. When you were three links into an Lona app and
refreshed the tab, the history before the refresh was unreachable.

Previously, both client1 and client2 created a new history entry, using
`history.pushState`, when a new view started, regardless the reason of the view
starting. So initial setup, refreshes, and reconnects also created history
items.
This is not correct! `history.pushState` should only be called when
you want to *extend* the browser history, beyond the normal history behaviour.

This patch limits all calls to `history.pushState` to cases of actual in-app
navigation, and adds a test to check the now corrected behaviour.

Signed-off-by: Florian Scherf <mail@florianscherf.de>
@fscherf fscherf force-pushed the fscherf/fix-browser-history branch from 99f210b to c726709 Compare March 20, 2024 20:16
@fscherf fscherf requested a review from rschwebel March 20, 2024 20:28
Copy link

@rschwebel rschwebel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thx!

@fscherf fscherf merged commit d5cf0fe into master Mar 21, 2024
5 checks passed
@fscherf fscherf deleted the fscherf/fix-browser-history branch March 21, 2024 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Browser back button not working in Firefox
2 participants