Repository navigation
Replies: 14 comments 11 replies
|
Tested on master rev |
|
@Firstyear I dont think ...
<form
onsubmit={ ctx.link().callback(|e| {
e.prevent_default();
AppMsg::ChangeState
} ) }
>
...
</form> |
|
Also im not sure what is going on here https://github.com/Firstyear/yew-sandbox/blob/main/src/manager.rs#L28 |
There are no examples of redirect on https://docs.rs/yew-router/latest/yew_router/ which is why I didn't know this existed. Everything refers to pushing history.
With the changes you suggested, this still doesn't work with push history. Main of the repro has been updated to show this. If anything removing the onaction actually causes more issues because then on the second form submit, it doesn't seem to invoke the onsubmit handler and then triggers the tradition submit which causes the route to bypass the yew router code causing a 404. Using |
|
Tested in chrome 96.0.4664.110 (Official Build) (x86_64) as well now. |
|
@Firstyear Ok sorry i completely missed what you are trying to do here. Dont use forms with submit buttons + push_route to navigate between pages. Try using Unless this is just a simplification and in real code you have to navigate on submit press, then idk how to help. |
|
Here are the docs: https://yew.rs/docs/concepts/router#navigation |
|
2 more things regarding with your setup: ctx.link()
.history()
.expect_throw("failed to read history")
.back();
|
|
Please ask further questions in Discussions tab or in our discord. I am closing this as this is not an issue that needs to be worked on. |
|
The thing is this previously worked with yew-router, so it's a regression actually. It also works if you don't use the router API and just signal for the components to be swapped. It also breaks if you remove the form, and just use the button as per the example of "mycomponent". See the updated commits to the repro. Using "Link" however works, which confuses me even more. The reason I wanted to use the form/submit is to allow an autofocus to the element so the user can press "enter" to proceed. And yes, I have the miniserve now working in spa mode so that the route is not 404'ing. |
|
Ok im not sure how to handle this issue, Could you look into this @futursolo ? |
|
No no sry i forgot this issue is related with his env setup |
|
@Firstyear Like I said your issue is not with yew or yew-router. The problem lies on how you serve your application. Read this 3 times or try googling the concepts mentioned here in 2nd point #2344 |
|
This is a bug, but not associated with When Yew registers an event listener, it registers on the I don't think you need to use I think other than this issue, the "manage body inside of virtual dom" also behaves poorly with the upcoming hydration and SSR. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem
When a form is submitted that triggers a yew router push_history event, and subsequent form that is rendered by yew is unable to be submitted.
Steps To Reproduce
Steps to reproduce the behavior:
To reproduce this, I have provided a minimised example in the following repository:
https://github.com/Firstyear/yew-sandbox
Expected behavior
Pushing a route to the history to change pages with yew_router should not break form submissions.
Screenshots
Environment:
Questionnaire
All reactions