Commit Graph
23 Commits
Author SHA1 Message Date
Dave Rolsky 69752313eb Fix typo in docs for NodeFactory.bump 2022-04-11 10:33:06 -05:00
Dave Rolsky 06ea624eec Make all packages which require futures-channel ask for the same version
If they aren't the same then Cargo cannot resolve a working version for some
reason.
2022-02-15 10:27:11 -06:00
Dave Rolsky 7c2d911fbf Fix closure signature for use_ref example in interactivity docs
The example showed the closure accepting a single argument, but it accepts
none.
2022-02-15 09:54:32 -06:00
Dave Rolsky 6537ad37b8 Add actual copies of the relevant licenses 2022-01-30 11:50:57 -06:00
Dave Rolsky d8ee553eac Fix the license field in Cargo.toml to be valid SPDX 2022-01-30 11:44:56 -06:00
Dave Rolsky 00ff54bb3b Fix typo in comment in use_shared_state.rs 2022-01-29 10:43:10 -06:00
Dave Rolsky 3d3d18554d Fix misspelled variable name in usestate.rs 2022-01-29 10:36:44 -06:00
Dave Rolsky 72c6bb3d0b Make log message in Link component trace level, not debug
All the other routing-related messages are at the trace level. Leaving this at
debug was an oversight on my part.
2022-01-28 15:31:43 -06:00
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 9b282d877b Don't expect all components to have a scope in ScopeArena.ensure_drop_safety
Not all components will be mounted when using a Router, so we cannot assume
all components have a scope.
2022-01-14 15:40: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
Dave Rolsky 51c177be9e Fix typo "misisng" that occurred in several error messages 2022-01-06 16:18:10 -06:00
Dave Rolsky 706b0e21a5 Fix reference to "html!" macro in "rsx!" macro docs 2022-01-06 10:44:05 -06:00
Dave Rolsky 31bd010226 Fix typo of Diane's name
Those two American kids are just growing up as fast as they can, huh?
2022-01-06 10:11:47 -06:00
Dave Rolsky a9500f3413 Fix typo in PostList example in guide 2022-01-06 10:11:30 -06:00