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

Provide a minimal example using a generic fragment adapter #1105

Closed
hgzimmerman opened this issue Dec 19, 2019 · 6 comments
Closed

Provide a minimal example using a generic fragment adapter #1105

hgzimmerman opened this issue Dec 19, 2019 · 6 comments
Labels
A-examples Area: The examples A-yew-router Area: The yew-router crate documentation

Comments

@hgzimmerman
Copy link
Member

Description

yewstack/yew_router#211 Made it possible to have proper fragment routing by wrapping a normal parser with an adapter that also implements Switch and matches anything up to a #.

An example should be created to demonstrate ho to create the adapter.

It should use the full featureset of the library, but be contained to just a single main.rs file in the same way that the minimal example is.

@jstarry jstarry transferred this issue from yewstack/yew_router Apr 20, 2020
@jstarry jstarry added documentation A-examples Area: The examples A-yew-router Area: The yew-router crate labels Apr 20, 2020
@chrysn
Copy link

chrysn commented Sep 12, 2020

I'm using an adapter that (if I understand the issue right) is roughly such an adapter, most easly viewed as its introducing patch. [edit] I should add that this is loosely based on cheako's adapter for a reference component in the path.

Using an adapter is a bit awkward as it means that at least where it is used with a Router, the actual route enum needs to be packed into and out of the adapter.

Might it not be preferable to have an option in the Switch derivation process to take the decision to disregard the pre-fragment of the URI right away? That might even be possible automatically if all the "to" start with a hash.

@siku2
Copy link
Member

siku2 commented May 18, 2021

@hamza1311 What's the situation for this with the new router?

@ranile
Copy link
Member

ranile commented May 18, 2021

@hamza1311 What's the situation for this with the new router?

Honestly, I have no idea what issue is about. I don't understand what a "generic fragment adapter" is.

@siku2
Copy link
Member

siku2 commented May 18, 2021

I guess this issue is no longer relevant anyway since it's about an example, but AFAIK the new router doesn't handle fragments (the part starting with #) in URLs at all and doesn't provide an easy way to access them. I imagine this should work much like query parameters (only that there's no need to go all fancy with deserializing).
Should we open a new issue to track that?

@ranile
Copy link
Member

ranile commented May 18, 2021

Should we open a new issue to track that?

Sure. I'm not sure how the implementation would look like. If you open the issue, I'd appreciate if you added some notes about implementation details

@siku2
Copy link
Member

siku2 commented May 18, 2021

Closing in favour of #1858

@siku2 siku2 closed this as completed May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-examples Area: The examples A-yew-router Area: The yew-router crate documentation
Projects
None yet
Development

No branches or pull requests

5 participants