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

Back Button Does Not Work #16

Closed
rmorshea opened this issue May 11, 2023 · 3 comments · Fixed by #18
Closed

Back Button Does Not Work #16

rmorshea opened this issue May 11, 2023 · 3 comments · Fixed by #18
Assignees
Labels
enhancement New feature or request

Comments

@rmorshea
Copy link
Contributor

Right now, if you click the browser's back button, the page does not update. We need to subscribe to changes in browser history and send them to the sever. I'm not really sure how best to achieve this in the long run. In the short run, I think this may require creating a hidden JS component that we display at the level of the router that does this.

@rmorshea rmorshea added the enhancement New feature or request label May 11, 2023
@rmorshea rmorshea self-assigned this May 11, 2023
@Archmonger
Copy link
Contributor

Archmonger commented May 13, 2023

There's also the additional complexity of: What happens if the user presses the back button enough to where they're not on a page that uses reactpy-router anymore?

We don't want to globally intercept all page changes. We only want to intercept page changes that can be resolved by an existing router node.

@rmorshea
Copy link
Contributor Author

rmorshea commented May 16, 2023

What happens if the user presses the back button enough to where they're not on a page that uses reactpy-router anymore?

That's handled with an effect cleanup in an invisible element that's rendered as part of the router.

We only want to intercept page changes that can be resolved by an existing router node.

I'm not really sure I understand this one. How would one know a priori whether a given location could be evaluated by a router node without checking? Besides, if no route matches, then the router just renders None which seems like the desired behavior.

@Archmonger
Copy link
Contributor

It's possible to record whether the URL was successfully evaluated as a data attribute within the invisible element. But if the effect cleanup is able to handle edge cases on it's own then this is likely not needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants