Commit Graph
24 Commits
Author SHA1 Message Date
Jonathan Kelley cc4b073f0d fix: use ordering of routes for router 2022-03-09 17:50:39 -05:00
Jonathan Kelley 0ce326566e wip: fix router slashing 2022-03-09 16:26:13 -05:00
Jonathan Kelley c7627f0b93 fix: tests pass 2022-03-04 13:16:37 -05:00
Jonathan Kelley cc83900334 feat: router crate is polished up 2022-03-04 13:16:37 -05:00
Jonathan Kelley f2979cb12a feat: apply local router changes 2022-03-04 13:16:37 -05:00
Ilya Maximov 916dc64402 style: format againkjdfakbjfbkasjd 2022-02-23 20:00:01 +01:00
Ilya Maximov bda4a71a72 feat: change schedule_update's Rc to an Arc
BREAKING CHANGE
2022-02-23 19:47:17 +01:00
Jonathan Kelley 06418f73db fix: element stack not being updated properly 2022-01-31 12:29:11 -05:00
Jonathan Kelley 3edf3e367f wip: debugging 2022-01-30 14:08:03 -05:00
Jonathan Kelley 9da46eb7bc chore: rustfmt 2022-01-28 12:07:10 -05:00
Jonathan Kelley 5ee9d6c434 fix: attach router listener to subscriber list 2022-01-28 12:04:16 -05:00
Jonathan Kelley a21e7d4dd1 fix: use_route should subscribe to changes to the route 2022-01-28 12:00:13 -05:00
Jonathan Kelley 29ed7ebece feat: connect an onchange listener 2022-01-25 15:06:37 -05: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 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
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 a4f280d163 feat: more API updates 2021-12-28 23:20:01 -05:00
Jonathan Kelley d298b626d3 wip: add router 2021-11-03 00:35:56 -04:00