Commit Graph
32 Commits
Author SHA1 Message Date
Jonathan Kelley d4b6bb8a7b feat: fix the scope rollover bug 2022-12-12 18:31:30 -08:00
Jonathan Kelley 1c3f4b2bc4 fix: use weak instead of sync 2022-12-07 15:42:39 -08:00
Jonathan Kelley df4a1b6c7a chore: finish tweaking context api 2022-12-05 15:30:49 -08:00
Jon Kelley 540e785d8b Less clumsy configuration for desktop and mobile (#553)
* chore: dont use prebuilt builder pattern for configuring desktop

* chore: use regular config pattern for web

* Chore: update docs too

* chore: clean up some warnings
2022-09-13 16:22:27 -07:00
Norman Paniagua 6e66d6fe36 Added initial_url to the router component (#510)
* added active_url

* renamed active_url to initial_url

* updated docs
2022-09-13 13:09:00 -07:00
Jon Kelley d9546d9504 Renderers are now packages, not features. (#387)
* feat: use synchronous router design

* feat: function to get router out of dom

* chore: restructure workspace to use renderers as packages, not features
2022-07-09 15:15:20 -04:00
Evan Almloff fbf8e13b8d clean up imports 2022-06-25 08:27:10 -05:00
Joshua Kifer 213f54c4d8 Convert all logs to trace 2022-03-27 09:23:44 -06:00
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