Commit Graph
32 Commits
Author SHA1 Message Date
Dave Rolsky 9e4ec43b1e Fix various typos and grammar nits
I also removed all trailing whitespace from lines since I have Emacs
configured to highlight this.
2022-01-21 21:43:43 -06:00
Dave Rolsky 64080588d0 Add a warning when Link it called outside of a Router context 2022-01-17 15:52:01 -06:00
Dave Rolsky 81c094ed29 Fix handling of re-renders in the Router
Previously the router just stored a `root_found` boolean after it picked a
route. But on re-render it would just always return false from `should_render`
if this was true. This just aborted routing after a future resolved (or
anything else that triggered a re-render).

Now we store the matching ScopeId and check that against our routes in a
re-render so we actually do re-render the matching route.
2022-01-14 14:55:12 -06:00
Dave Rolsky e06eac1ce5 More WIP router implementation 2022-01-13 12:26:49 -06:00
Dave Rolsky c9408da731 Implement UseRoute segment method
This relies on the RouterService to capture path params when it does path
matching.
2022-01-13 12:21:06 -06:00
Dave Rolsky f8a7e1cd82 Implement router matching for path parameters
We don't want to have the router just always match paths as exact strings. If
a path contains a parameter like "/thing/:id" then the ":id" portion of the
route should match _any_ string, not a literal ":id".
2022-01-13 12:21:06 -06:00
Dave Rolsky 3c6142fb9d Commit WIP on router
There are a few different changes in here that probably need to be picked
apart. I'm sure much of this is wrong.

* Fix missing `dyn` that compiler complained about in router.rs

* Make UseRoute store a `Rc<RouterService>` rather than a string so we can get
information out of the router like current location.

* Implement `UseRoute`'s nth_segment and last_segment methods. I changed the
return type to a String because of the above.

* Remove some unused imports in platform/mod.rs and service.rs

* Implement the `use_route` fn. It panics if called outside a Router { } (I
think). I think that makes sense.

* Add a `current_location` method to `RouterService` that returns the current
location. I needed this both for the `UseRoute` implementation and _also_ so I
could get at this in my webapp code. I think having some way to get this will
be useful for others, whether or not this exact API is used. In my case, I
want to compare the current path to the `to` path of a `Link` so I can use a
different class for that `Link` if it is the currently active page.
2022-01-13 12:21:06 -06:00
Dave Rolsky 3a5b417ad1 Add more trace messages to the RouterService code
I was trying to debug some issues with my routes and this additional tracing
was quite helpful.
2022-01-13 12:21:06 -06:00
Dave Rolsky d367e0f89f Fix typo in RouterService struct's "registered_routes" field name
This was "registerd_routes", missing an "e".
2022-01-13 12:21:06 -06:00
Dave Rolsky e22ba5b1e5 Add title prop to Link
Every element can have a title, but it's particularly useful on links, so I
think making it an explicit option is worthwhile.
2022-01-13 12:21:06 -06:00
Jonathan Kelley d2372717bd feat: flatten props attrs 2022-01-10 02:57:03 -05:00
Alexandre Kirszenberg b6903bf558 Enable clippy 2022-01-08 16:35:26 +01:00
Jonathan Kelley bd341f5571 fix: tests 2022-01-05 17:30:12 -05:00
Jonathan Kelley e2a6454527 chore: switch to log tracing 2022-01-05 16:36:42 -05:00
Jonathan Kelley 427b126bc1 feat: add prevent default attribute and upgrade router 2022-01-05 16:34:24 -05:00
Jonathan Kelley cb2782b4bb wip: memoize dom in the prescence of identical components 2022-01-05 00:27:22 -05:00
Jonathan Kelley 75fa7b4aa6 fix: make tests pass 2022-01-03 01:12:39 -05:00
Jonathan Kelley 420a30e5d4 feat: overhaul examples and clean things up 2022-01-03 00:42:17 -05:00
Jonathan Kelley d1560450ba wip: remove runner on hook and then update docs 2022-01-02 02:15:04 -05:00
Jonathan Kelley 4c85bcfdc8 awesome: arbitrary expressions excepted without braces 2021-12-30 03:14:47 -05:00
Jonathan Kelley a4f280d163 feat: more API updates 2021-12-28 23:20:01 -05:00
Jonathan Kelley cda759c659 examples: upgrade to new version of dioxus core.
also add the inline_props macro
2021-12-25 17:18:05 -05:00
Jonathan Kelley 934de21dd6 wip: miri stress tets 2021-12-18 23:03:59 -05:00
Jonathan Kelley 2fd56e7619 wip: remove portals completely 2021-12-14 21:46:19 -05:00
Jonathan Kelley 8daf7a6ed8 wip: go back to noisy lifetime solution 2021-12-14 02:27:59 -05:00
Jonathan Kelley 8814977eee wip: docs 2021-11-30 22:48:05 -05:00
Jonathan Kelley bab21a0aa1 wip: updates to router 2021-11-22 15:22:42 -05:00
Jonathan Kelley a5f05d73ac wip: docs and router 2021-11-19 00:49:04 -05:00
Jonathan Kelley 8acdd2ea83 feat: it compiles once more 2021-11-11 16:36:51 -05:00
Jonathan Kelley d298b626d3 wip: add router 2021-11-03 00:35:56 -04:00
Jonathan Kelley fd7933561f chore: move CLI into its own "studio" app 2021-07-07 16:58:23 -04:00
Jonathan Kelley 6aeea9b790 Feat: add router 2021-01-20 17:48:58 -05:00