Replies: 14 comments 11 replies
-
Tested on master rev |
Beta Was this translation helpful? Give feedback.
-
@Firstyear I dont think ...
<form
onsubmit={ ctx.link().callback(|e| {
e.prevent_default();
AppMsg::ChangeState
} ) }
>
...
</form> |
Beta Was this translation helpful? Give feedback.
-
Also im not sure what is going on here https://github.com/Firstyear/yew-sandbox/blob/main/src/manager.rs#L28 |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
Tested in chrome 96.0.4664.110 (Official Build) (x86_64) as well now. |
Beta Was this translation helpful? Give feedback.
-
@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. |
Beta Was this translation helpful? Give feedback.
-
Here are the docs: https://yew.rs/docs/concepts/router#navigation |
Beta Was this translation helpful? Give feedback.
-
2 more things regarding with your setup: ctx.link()
.history()
.expect_throw("failed to read history")
.back();
|
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
Ok im not sure how to handle this issue, Could you look into this @futursolo ? |
Beta Was this translation helpful? Give feedback.
-
No no sry i forgot this issue is related with his env setup |
Beta Was this translation helpful? Give feedback.
-
@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 |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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
Beta Was this translation helpful? Give feedback.
All reactions