-
Notifications
You must be signed in to change notification settings - Fork 50
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
Add the ability to follow links #173
Conversation
For this we added another Variant to the BlitzEvent Enum and also made DocumentLike return an Option<DocumentEvent> which currently just has one Variant for following links. I consider this a working POC, which needs to be fleshed out. I didn't invest any time to make sure the DioxusSide still works. It most likely won't because of the change in the trait definition.
@nerdachse I reckon we ought to create a I don't like the way the current implementation uses the return value, because I think it's non-obvious that this is what the return value would, and also because I think it is likely we will want to add more events in future (possibly even with a single handler generating more than one), and I think it would be difficult to allow for multiple events if using the return value. |
I agree, that's why I proposed two different implementation strategies. I like that your solution has a specific Provider and not just the whole EventLoop exposed to the document. I'll get to it as soon as I can! |
Instead of bloating the document with another optional Event on `DocumentLike`'s' `handle_event` method, we introduce a `NavigationProvider` similar to the existing `NetProvider`. Currently it only has one method for navigating to a new page, but this may change in the future.
Still not finished for Happy to hear your feedback @nicoburns! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The basic structure of this looks good. I have suggested a few tweaks in individual comments. Additionally compiling for some apps (dioxus-native, wpt runner) is broken which will need to be fixed before we can land this. You can check all apps by running cargo build --workspace
(or checking the CI output).
Sure, I just didn't want to waste time. Now that the path forward is clear, I'll fix it :) |
…n Option<Url> instead of panicking when parsing is not possible
What this explicitly does not do is set the title of the window accordingly. So when you follow a link to another page, the title stays the current one. |
@nicoburns when you're ready to merge, please squash. Thanks :) |
For this we added another Variant to the BlitzEvent Enum and also made
DocumentLike return an Option which currently just has
one Variant for following links.
I consider this a working POC, which needs to be fleshed out.
I didn't invest any time to make sure the DioxusSide still works. It
most likely won't because of the change in the trait definition.
@nicoburns If this is about what you want, I am happy to work on this, as my time allows. If I've diverged too far from your vision, that's also fine!
It's a working POC. When I open the readme app and click a link, the Document is replaced.