Skip to content

Allow customizing basis of route detection#1977

Closed
SOF3 wants to merge 1 commit into
yewstack:masterfrom
traffloat:path-basis
Closed

Allow customizing basis of route detection#1977
SOF3 wants to merge 1 commit into
yewstack:masterfrom
traffloat:path-basis

Conversation

@SOF3
Copy link
Copy Markdown
Contributor

@SOF3 SOF3 commented Jul 31, 2021

Description

Allow choosing pathname, query or hash to detect the route.

Checklist

  • I have run cargo make pr-flow

  • I have reviewed my own code

  • I have added tests

@SOF3
Copy link
Copy Markdown
Contributor Author

SOF3 commented Jul 31, 2021

I am not sure how to write tests for this. Any guidance regarding how to emulate the window.location environment properly?

@teymour-aldridge
Copy link
Copy Markdown
Contributor

@SOF3 You might find this section of the wasm-bindgen guide for testing in browsers useful. I would imagine that something like "open browser" -> "use appropriate function in web-sys to set route" -> "test Yew code" is probably the right way to go.

@mc1098 mc1098 added the A-yew-router Area: The yew-router crate label Sep 20, 2021
@voidpumpkin
Copy link
Copy Markdown
Member

@SOF3 I Agree with adding another router like BrowserRouter, like HashRouter
But what do you mean by pathname or query, i think pathname translates to use of BrowserRouter all the time, and query should always be optional to hook into, after #1892 gets merged

@voidpumpkin voidpumpkin added the S-waiting-on-author Status: awaiting action from the author of the issue/PR label Nov 21, 2021
@ranile
Copy link
Copy Markdown
Member

ranile commented Nov 21, 2021

I Agree with adding another router like BrowserRouter, like HashRouter

This is how this PR should be implemented. In the current state, it would be easier to re-create this PR from a fresh slate. I will leave this open though.

One more thing I would like to add: it'll be better to use gloo-history (ranile/gloo#166) crate instead of implementing HashHistory/HashLocation ourselves

@voidpumpkin
Copy link
Copy Markdown
Member

@hamza1311 Actually im closing this since the author has not updated it for too long,
@SOF3 Feel free to ping me if you want to push new updates and need this reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-yew-router Area: The yew-router crate S-waiting-on-author Status: awaiting action from the author of the issue/PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants