leptos
in the wild
#2442
Replies: 2 comments
-
Hi everyone, Here are a few extension traits we use internally which might be of general-ish interest.
|
Beta Was this translation helpful? Give feedback.
-
(Converting this from an issue into a discussion simply because it's not a single, actionable item so there's not really a way to "close" it at any point. Feel free to open individual feature request issues, bug reports, or PRs as relevant — IIRC you have already made PRs!) |
Beta Was this translation helpful? Give feedback.
-
Hi everyone!
We recently ported our codebase from
sycamore
toleptos
. It's still pretty early, but things have been working well.:D
I just wanted to drop in to share some things we have tweaked and/or extended in case there is interest in how things are being used in the wild and maybe upstreaming some of the more widely-applicable changes.
Our more relevant changes:
Avoid swallowing errors from event handlers. fix: re-throw errors in delegated event listeners #2382
We added an assertion to avoid delegated event handlers silently overwriting each other. fix: prevent setting the same event listener twice #2383
Signals not printing their values made debugging tricky, so we added that. The added bound didn't cause any issues for us. feat: print inner value in
Debug
impls #2384We changed
PartialEq
to compare by value.The reasoning:
sycamore
and we wanted to reduce the diff during the port. I don't think this ended up mattering much.BTreeMap
would be subscribing to unpredictable subsets of the signals inside without that being obvious.Hash
was also changed to match Giovanni-Tably@f658d6a)Exporting
ReactiveSystemError
. It was already public, just unreachable and I wanted to handle the case where an owner has been disposed of manually (to print debug warnings). Giovanni-Tably@ae31550Exposing direct access to raw
Text
nodes for some thorny ContentEditable logic. Giovanni-Tably@b4859e1A few more are visible in our fork here: Giovanni-Tably#3.
Some context:
leptos
's SSR.RwSignal
andSignal
in interfaces. Have been toying with adding a r/w equivalent ofSignal
to avoid using effects for double binding.ReactiveMerge
, which is similar to aStore
but not quite if I understand correctly. I'll write something up if there is interest, but it's essentially a way to easily manage nested signals which is useful and ergonomic for routing and other data that closely matches the render tree.Hope this is helpful!
I am happy to elaborate and open PRs to upstream anything you think makes sense.
All in all, we have been very happy with the transition, so thank you for pushing the envelope of what Rust in the FE can do!
Beta Was this translation helpful? Give feedback.
All reactions