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

Router not executed on page changes #8

Closed
arctic-hen7 opened this issue Sep 12, 2021 · 7 comments
Closed

Router not executed on page changes #8

arctic-hen7 opened this issue Sep 12, 2021 · 7 comments
Assignees
Labels
C-bug Category: bug
Milestone

Comments

@arctic-hen7
Copy link
Member

This is a tracking issues for a series of bugs in Perseus related to the custom routing systems.

  • Locale detection routes to blank page that only renders on reload, going back triggers panic
  • Clicking a link will do nothing, panicking in the background, but it works the second time

These bugs are all to do with the way Sycamore currently handles its ContextProvider system (detailed here), and they should all be fixed by this PR in Sycamore, which will be released shortly with Sycamore v0.6.0.

After that, those updates will be integrated into Perseus for v0.2.0, and this issue should then be closable. This primarily exists to forewarn anyone who has decided to compile the main branch and is experiencing these issues.

This was referenced Sep 12, 2021
@arctic-hen7 arctic-hen7 added this to the v0.2.0 milestone Sep 15, 2021
@arctic-hen7
Copy link
Member Author

Now that that PR has been merged, there are a few minor changes that need to take place for this to work with regards to setting global variables.

@arctic-hen7
Copy link
Member Author

Okay, fixing this seems to be just about impossible until we can get the user's Routes into the RouteVerdict enum somehow. Right now, that's done with context, which doesn't work because it's not in a reactive scope, and global variables can't be used because they need to be generated in the CLI subcrates with macros. If the Route trait's method match_route took &self as a parameter, this would enable the very efficient solving of just about all these problems, which I've proposed here. Until there's some action there, this likely won't go anywhere. Any other solutions would be greatly appreciated!

@arctic-hen7 arctic-hen7 self-assigned this Sep 16, 2021
@arctic-hen7 arctic-hen7 added the C-bug Category: bug label Sep 16, 2021
@arctic-hen7 arctic-hen7 changed the title Blank pages and failing links Router not executed on page changes Sep 17, 2021
@arctic-hen7
Copy link
Member Author

With #12 dealt with, this is now a single problem in the router, as a verdict is successfully generated, but for some reason Sycamore then doesn't run the logic to match that verdict and actually render a new page. This results in no exceptions and no identifiable error messages.

@arctic-hen7
Copy link
Member Author

With #2 closed and major changes to the app shell, this bug is now manifested in its third iteration: locale detection will call Sycamore's navigate function, which causes a blank screen, and all other routes are treated as external and reload the entire page. Neither of these behaviors are desirable, but the first priority should now be to have all routes treated as internal and thus to simplify this down to one problem of router execution, as it was in its previous version.

@arctic-hen7
Copy link
Member Author

Okay, the new issue of not intercepting click events seems to be caused by the fact that the Sycamore router only handles click events for its children, and Perseus simply renders an empty template, hydrating to an element that the router doesn't control. I'll work on a fix for this now, and see what happens to the other part of this bug.

@arctic-hen7
Copy link
Member Author

Okay, we are back to one bug! Links now behave correctly as in an SPA, and now it's just that the closure passed to Router is never properly called.

arctic-hen7 added a commit that referenced this issue Sep 19, 2021
Links now behave correctly, but are still subject to #8.
@arctic-hen7
Copy link
Member Author

Thank you @lukechu10 for all your help on this one! Greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

1 participant