caniuse.rs icon indicating copy to clipboard operation
caniuse.rs copied to clipboard

Implement querystring

Open Heiss opened this issue 2 years ago • 4 comments

Hello,

this are my first steps in yew and wasm. This PR implements my previous request in https://github.com/jplatte/caniuse.rs/issues/67 .

It implements a new router /search/:query and redirect the input to the header. Also it implements a location.replace for input, so it sets the url while you are typing your search query. Also, I added urlencoding as dependency to handle special characters in url.

Small addition: I fixed the build command, so it works on windows (i am switching between 2 machines), too.

It would be cool to see this in your service.

Have a great day.

Heiss avatar Mar 02 '23 20:03 Heiss

Thank you for your input.

I remove the extra dependency and implement the query via hash. Also i hide the query now on create-event, so it does not involve any big changes to your code except the first lookup.

I place a text about the query feature into the about page, too.

If you want to see, why i wan this feature: I adjust my search app for rust to the new hash implementation already.

Heiss avatar Mar 04 '23 14:03 Heiss

I just tried and it seems to work only for opening /#q=query, not like before where it also updated the URL when searching. That's probably intentional / what you had working locally too?

jplatte avatar Mar 12 '23 10:03 jplatte

yes this was on purpose, because something breaks, if i update the query string every keystroke and this is also my first time to interact with yew, so i did not found a fix. So i remove the querystring from url after the app init, so the UX is the same as before but with a new feature, described in the about page.

Heiss avatar Mar 16 '23 11:03 Heiss

Okay, that makes some sense. However the # still remains after opening the page.. Maybe you can try fixing that? I think then I can merge this, and further features can be added later.

jplatte avatar Mar 16 '23 11:03 jplatte