Commit Graph
44 Commits
Author SHA1 Message Date
Evan Almloff d8d11db403 Boxed and mapped signals preparing for stores (#4413)
This PR contains just the breaking changes required for the upcoming store implementation. It adds two new primitives:

Mutable mapped signals (without a different subscriber list). This lets you scope a writable value and pass it to a child component. It requires two closures to map the immutable and mutable references to the inner signal. With stores, these closures will be derived
Boxed readable and writable values (ReadSignal, and WriteSignal). Any readable or writable types can be converted to a read signal or write signal with the boxed method or built in types are automatically converted into the boxed variants when passing into props


* map signals mutably

* boxed signals

* remove mutable borrow type from boxed writable

* improve map mut example

* restore boxed_mut helper

* make boxed readable/writable types copy

* Move away from the ReadOnlySignal alias in examples

* automatically convert Write

* Fix some tests

* ReadSignal and WriteSignal

* move read only signal alias

* make maps copy

* store prototype

* implement derive macro

* Handle generics in the derive macro

* Make Selector boxable

* derive boxed conversion

* Get rid of store type

* Remove hardcoded type from derive macro

* selector -> store

* Refactor store implementation

* more vec methods

* todo mvc store example

* Implement Storable for HashMap

* fix write

* restore sorting logic in todomvc

* derive readable and writable

* improve todomvc store example

* Result store

* Option store

* collect dead subscribers

* fix clippy and formatting

* recognize some common foreign types automatically

* fix foreign stores in props

* slice and array selectors

* clean up store example

* remove stores

* writable is child owned

* fix typo

* fix clippy

* fix doc tests
2025-07-31 13:19:55 -07:00
Evan Almloff 14081e7e45 Add a warning when a copy value is used in a higher scope than it was created in (#2771) 2024-08-02 10:48:13 -07:00
Evan Almloff b6dc2a2230 Deduplicate reactive scope updates/Reset subscriptions on reruns/fix use memo double update (#2506)
* deduplicate effect updates

* only subscribe to signals read in the current run of reactive scopes

* subscribe to memo reads after recomputing the value
2024-06-18 18:49:25 -07:00
Evan Almloff 1d72ef16c4 Restore set compare hook (#2287)
* restore set compare hook

* fix use_set_compare doc example

* add a hook to compare a value with a set

* implement partialeq for SetCompare

* export the new hook

* fix the use_set_compare hook
2024-04-26 11:55:11 -04:00
Evan Almloff 4c209e39fe re-export generational box error types from the signals crate (#2212) 2024-04-02 10:52:27 -07:00
Evan Almloff 492f0329bf remove flume, implement lazier memos 2024-03-06 11:38:28 -06:00
Evan Almloff 8324f5290a rename rc to reactive context to avoid confusion with Rc 2024-02-05 07:24:31 -06:00
Jonathan Kelley 7d78e5e250 Fix warnings and compile errors 2024-02-03 13:10:16 -08:00
Jonathan Kelley dd06705ff1 implement use_async_memo with reactive context 2024-02-01 13:21:53 -08:00
Jonathan Kelley 7c2947a131 Implement effects using reactivecontext 2024-02-01 13:21:52 -08:00
Jonathan Kelley cef64d43df move hooks out of signals crate 2024-01-29 17:02:26 -08:00
Evan Almloff 50e3216d8b convert T into signals automatically 2024-01-29 13:36:39 -06:00
Evan Almloff c3555a7ec0 fix Option<String> in props 2024-01-24 16:40:14 -06:00
Evan Almloff 87dc409837 remove must use hints from memo and rename file to memo 2024-01-24 09:31:29 -06:00
Evan Almloff 51d7133ca5 add readable and writable traits for signal-like structs 2024-01-23 10:05:59 -06:00
Evan Almloff 89b7784d31 make validate private again 2024-01-23 07:32:53 -06:00
Jonathan Kelley 079fec3be6 simplify generational box by compressing debug info 2024-01-22 21:17:02 -08:00
Jonathan Kelley 60f5697e8e Fix global signal owner 2024-01-19 15:48:21 -08:00
Evan Almloff bc914deeaa create Signal::global 2024-01-19 13:46:17 -06:00
Evan Almloff 69a1ec0e3c Merge branch 'create-comparer' into maybe-sync-signal 2024-01-08 13:56:11 -06:00
Evan Almloff cddcd69200 Merge branch 'maybe-sync-signal' into map-signal 2024-01-02 14:17:01 -06:00
Evan Almloff b3c5158524 fix tests 2023-11-07 13:15:19 -06:00
Evan Almloff 466005890d make effect system async to make signals send + sync 2023-11-06 18:47:51 -06:00
Evan Almloff d815c7cc89 create a reactive selector called comparer 2023-10-31 18:30:06 -05:00
Evan Almloff 4b8701e3eb Merge branch 'master' into map-signal 2023-10-17 13:45:36 -05:00
Evan Almloff 3578f03f4f add the ability to map signals 2023-10-11 12:43:22 -05:00
Leonard 2d1234c3d1 Include README and Dioxus logo in package docs (#1536)
* Include README in docs.rs and add Dioxus logo

* Update README.md
2023-10-10 10:52:48 -05:00
Evan Almloff d6089bbd35 add optional dependency variants of selectors and effects 2023-08-08 13:06:33 -07:00
Evan Almloff 4447709ac8 add readmes 2023-08-07 17:49:14 -07:00
Evan Almloff 2c7d0700d4 rename memo to selector 2023-08-07 16:17:47 -07:00
Evan Almloff 646c161c7d create read only signal 2023-08-07 16:04:49 -07:00
Evan Almloff 190c65b15d fix memo and add tests 2023-08-07 14:31:03 -07:00
Evan Almloff 7f2049b647 add memo 2023-08-07 12:32:46 -07:00
Evan Almloff 717c09c4a3 create tests for signals 2023-08-07 11:52:54 -07:00
Evan Almloff dce418140a create a way to hoist ownership to a different scope 2023-08-04 17:50:05 -07:00
Evan Almloff a6f611eccf fix subscriptions in events 2023-08-04 17:23:57 -07:00
Evan Almloff 3242fc9e88 add debug impl 2023-08-04 14:49:52 -07:00
Evan Almloff 2b6b3b67b1 move dioxus copy into a separate package 2023-08-04 14:28:55 -07:00
Evan Almloff 04cdb14e5b improve signal copy runtime 2023-08-04 13:53:05 -07:00
Evan Almloff a96ccdc6f3 fix clippy 2023-07-18 13:16:17 -07:00
Jonathan Kelley 2d8841cf70 Add lazy contexts to signals 2023-07-14 12:52:49 -07:00
Jonathan Kelley 14a1e4145e feat: implement function accessor 2023-01-01 22:57:16 -05:00
Jonathan Kelley c0315e55f4 chore: more signals methods 2023-01-01 22:02:49 -05:00
Jonathan Kelley 4f9d67fb45 feat: simple signals implementation 2023-01-01 19:57:33 -05:00