-
-
Notifications
You must be signed in to change notification settings - Fork 9
Solidart v3: Refactor v3 core API and align ecosystem packages #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
medz
wants to merge
122
commits into
main
Choose a base branch
from
refactor/3.0-dev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
122 commits
Select commit
Hold shift + click to select a range
08336b3
Replace custom reactive system with alien_signals preset
medz 10f733f
Migrate to alien_signals for reactive system management
medz 0b3795e
Replace alien_signals imports with internal deps re-exports
medz 1de6865
Refactor Effect to extend preset.EffectNode directly
medz 9ad4ae7
Add v3 API implementation
medz 3d34fb9
Rename v3 module to next
medz dcb542e
WIP: Remove legacy next.dart and introduce simplified v3 API
medz 0095e25
legacy: Rename update method to didUpdate in internal signals
medz 109ba0d
Add Disposable interface and mixin for reactive primitives
medz 76d6bc4
Add v3.dart as a re-export entry point
medz 7693e13
Add Configuration interface and global autoDispose setting
medz 6a71777
Add name and autoDispose parameters to Effect constructor
medz f151329
Replace signal name with unique identifier
medz 915d958
Update import path to use solidart/v3.dart
medz 02ac378
Export SolidartConifg and remove unused exports from v3
medz bf8c734
Add advanced exports for v3 features
medz 48bddcb
Add isInitialized getter to LazySignal
medz 7492035
Add toReadonly method to Signal class
medz 8290c55
Update TODO comments for naming discussions
medz 185d600
Add TODO for code comments in v3.dart
medz 3ba4ad4
Simplify LazySignal.value getter by removing braces
medz 898bed3
Add dispose method to Effect class
medz 550c194
Enable auto-dispose by default and implement cascade disposal
medz a254bf2
Fix typo in DisposableMixin and SolidartConfig class names
medz bda3747
Fix typo in SolidartConfig class name
medz 8bb413a
Add untrackedValue getter to ReadonlySignal
medz 8699c1f
Add disposal assertions to Signal and Computed value getters
medz d9d4e0a
Add custom equality comparator to signals and computed
medz e29ad72
Add tests for custom equals comparators in Signal and Computed
medz 4082705
Change default autoDispose to false and add detach flag
medz 57414c3
Add Effect.delay factory and refactor Effect.run
medz c63bb36
Fix missing semicolon in Effect timer callback
medz 2a1cf09
Add fake_async dev dependency and test Effect.delay
medz 06d1d88
WIP: *
medz f72074e
Remove delayed effect support from Effect
medz 3ef0fde
Add previous value tracking to signals and computeds
medz c6d3ea2
Add batch and untracked utility functions
medz 3eb2dd4
Add reactive collections and resource API
medz 63c5285
Add DevTools integration and observer pattern for signals
medz 7417d00
Fix LazySignal value check and add no-op mutation tests
medz 28b3735
Add documentation for v3 reactive primitives
medz 11eacab
Bump solidart version to 3.0.0-dev.1
medz abfd39c
Update to solidart v3.0.0-dev.1
medz f1c7174
Clean v2 code and align v3 entry points
medz 5120f8a
Align ecosystem to solidart v3
medz 68481c5
Guard SignalBuilder effect after unmount
medz bade610
Merge branch 'main' into refactor/3.0-dev
medz a2ca9e8
Trim devtools extension to v3 signals
medz 006f448
Adapt solidart_hooks to v3 APIs
medz ae8b7a7
Fix v3 tests and examples
medz 321821f
Bump v3 package versions
medz 089cbca
Update docs to v3
medz 25e87d8
Bump alien_signals and fix toggle_theme icons
medz 502cc56
Enable web builds for examples
medz be1517b
Handle SignalBuilder build errors
medz f77c2f8
Fix ReactiveMap addAll no-op check
medz f935c6e
Clarify auto-dispose behavior
medz e4ee6f6
Improve ReactiveMap docs
medz 9ca698b
Guard devtools JSON against cycles
medz 0b9623b
Refine docs and JSON guard
medz 402b4e3
Use idiomatic Effect disposal in docs
medz 24779cc
Use ReactiveMap _copy helper
medz ff72cd1
Clarify Effect disposal guidance
medz ab56156
Use untracked in Computed
medz df64bc7
Fix collections_test lint
medz 8ca2021
Rename ReactiveList, ReactiveSet, and ReactiveMap to ListSignal,
medz 0968d97
remove unused config
medz b7a5bb8
Add comprehensive collection signal tests and fix formatting
medz b4221dc
Rename reactive collection hooks to use *Signal naming
medz 6311e6b
Fix unused expression warnings in test files
medz 4a7a8b7
Add comprehensive tests for collection signals and utilities
medz 928909f
Add test coverage for edge cases and improve test reliability
medz 094286a
Add coverage ignore comment to SolidartObserver constructor
medz b875d6f
Fix capitalization in LazySignal error message
medz ffae0bd
Update docs-v2/src/content/docs/advanced/automatic_disposal.mdx
medz 16d419f
Update docs-v2/src/content/docs/advanced/automatic_disposal.mdx
medz 3b78030
Update docs-v2/src/content/docs/advanced/automatic_disposal.mdx
medz d0bd906
Update docs-v2/src/content/docs/advanced/automatic_disposal.mdx
medz 9a48fbe
Update docs-v2/src/content/docs/flutter/signal_builder.mdx
medz fe54312
Update docs-v2/src/content/docs/advanced/automatic_disposal.mdx
medz aa662ed
Update v3 docs and signal builder checks
medz e476313
Add call operator to Signal, ReadonlySignal, and Computed
medz 725dfc2
Add SignalBuilder and Show widget tests
medz 0348d1f
Update sidebar order for collection signal documentation
medz f017c7d
Fix SignalBuilder test line length
medz e1a90a5
Fix call operator test to use type inference
medz 74bfca7
Fix SignalBuilder doc grammar
medz 437f720
Document effect disposal in collection examples
medz 1e20c86
Rename solidart_hooks example pages
medz d459be9
Wrap Computed and Resource as Listenable
medz 48d1319
Add Listenable Signal wrapper
medz 91ae817
Document listenable wrappers
medz db073db
Wrap collection signals as listenable
medz deef83d
Align listenable signal wrappers
medz 7b329cf
Restore observe extension
medz 65c5931
Drop v3 from devtools extension names
medz 147e310
Rename v3 templates
medz e1760cc
Add ObserveSignal tests
medz 0ea6dd5
Add listenable wrapper coverage tests
medz 8a78610
Refine listenable wrapper coverage test
medz cd4ffa5
Guard null devtools signal ids
medz 2caea62
CHANGELOG formatting and consolidate v3 dev entries
medz 6a13f23
Revert docs-v2 to main
medz 4c9c9fc
Update CHANGELOG for v3.0.0-dev.0 release
medz ac936ab
Update CHANGELOG for v3.0.0-dev.0 breaking changes
medz b491916
Align flutter_solidart dev versions
medz 2bd526d
format
medz 4149fe5
Remove unused cupertino_icons dependency
medz d6744ed
Remove cupertino_icons dependency from example apps
medz 7960a10
Update lazy counter example to use Signal.lazy factory
medz 792d30d
Add isInitialized property to Signal base class
medz a639ce5
Simplify lazy counter pattern matching
medz a2f94fc
sort member
medz 4ae9d1c
Restore until helpers in v3
medz 9cfcca6
Split solidart.dart into part files
medz facc411
Fix coverage ignore markers
medz 9ea195f
Update migration guide for v3 API changes
medz a666b14
Update migration guide with correct v3 counter increment example
medz 9b1b9b7
Fix lazy signal update and resource refresh
medz 170e099
Add observe callbacks to collection signal examples
medz 1af3f35
Translate Chinese debug messages to English in example pages
medz 9fe9d76
Simplify example signal logging
medz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| --- | ||
| title: Migration (v2 -> v3) | ||
| description: Upgrade guide for solidart v3 | ||
| --- | ||
|
|
||
| This guide is generated by comparing **v2** with **v3**. It reflects the actual | ||
| public API changes in | ||
| `solidart`, `flutter_solidart`, and `solidart_hooks`. | ||
|
|
||
| ## 1) Update package versions (upgrade together) | ||
|
|
||
| ```yaml | ||
| # pubspec.yaml | ||
|
|
||
| dependencies: | ||
| solidart: 3.0.0-dev.0 | ||
| flutter_solidart: 3.0.0-dev.0 | ||
| solidart_hooks: 3.2.0-dev.0 | ||
|
|
||
| dev_dependencies: | ||
| solidart_lint: 3.0.3 | ||
| ``` | ||
|
|
||
| ## 2) Entry points and exports | ||
|
|
||
| ### solidart | ||
|
|
||
| **v2 (main) exported:** | ||
|
|
||
| - `src/core/core.dart` | ||
| - `src/extensions/until.dart` | ||
| - `src/utils.dart` (Debouncer / SolidartException, etc.) | ||
|
|
||
| **v3 (current) exported:** | ||
|
|
||
| - `Signal`, `Computed`, `Effect`, `Resource`, `ListSignal`, `MapSignal`, `SetSignal` | ||
| - `ReadonlySignal`, `SolidartConfig`, `SolidartObserver` | ||
| - `ObserveSignal`, `UntilSignal` | ||
| - `batch`, `untracked` | ||
| - `DisposeObservation`, `ObserveCallback`, `ValueComparator` | ||
|
|
||
| **New advanced entry point:** | ||
|
|
||
| ```dart | ||
| import 'package:solidart/advanced.dart'; | ||
| ``` | ||
|
|
||
| Exports `Configuration`, `Disposable`, `DisposableMixin`, `Identifier`, | ||
| `Option`, `Some`, `None` (previously in core/utils). | ||
|
|
||
| ## 3) Core API changes (main -> current) | ||
|
|
||
| ### 3.1 Types and naming | ||
|
|
||
| | v2 (main) | v3 (current) | Notes | | ||
| | ------------------------------------- | --------------------------------- | ---------------------------------------------- | | ||
| | `SignalBase<T>` | `ReadonlySignal<T>` / `Signal<T>` | `SignalBase` removed | | ||
| | `ReadSignal<T>` / `ReadableSignal<T>` | `ReadonlySignal<T>` | ReadSignal types removed | | ||
| | `toReadSignal()` | `toReadonly()` | Rename | | ||
| | `disposed` | `isDisposed` | Rename | | ||
| | `hasValue` | `LazySignal.isInitialized` | Normal `Signal` is always initialized | | ||
| | `hasPreviousValue` | Removed | Use `previousValue` / `untrackedPreviousValue` | | ||
| | `name` | `identifier.name` | `name` field removed from public API | | ||
|
|
||
| ### 3.2 Signal updates | ||
|
|
||
| **Removed:** `updateValue` / `setValue` public API. | ||
|
|
||
| Use `.value` assignment instead. | ||
|
|
||
| ```dart | ||
| // v2 | ||
| counter.updateValue((v) => v + 1); | ||
|
|
||
| // v3 | ||
| counter.value += 1; | ||
| ``` | ||
|
|
||
| **Comparator change:** | ||
|
|
||
| - v2 had `equals` (bool) + `comparator` | ||
| - v3 keeps only a comparator: | ||
|
|
||
| ```dart | ||
| final s = Signal(0, equals: (a, b) => a == b); | ||
| ``` | ||
|
|
||
| ### 3.3 Effect | ||
|
|
||
| **v2:** `Effect(callback, delay:, onError:, autorun:)` and `effect()` to dispose. | ||
| **v3:** `delay`, `onError`, `autorun` removed. Dispose via `effect.dispose()`. | ||
|
|
||
| ```dart | ||
| // v2 | ||
| final dispose = Effect(() { ... }, delay: ..., onError: ...); | ||
| dispose(); | ||
|
|
||
| // v3 | ||
| final effect = Effect(() { ... }); | ||
| effect.dispose(); | ||
| ``` | ||
|
|
||
| If you need delayed/debounced effects, use `Timer`/debounce in user code. | ||
|
|
||
| ### 3.4 Resource | ||
|
|
||
| - `source` now accepts `ReadonlySignal` instead of `SignalBase`. | ||
| - `update` / `updateValue` removed → set `state` directly. | ||
| - `ResourceExtensions` replaced by `ResourceStateExtensions`. | ||
| - `on()` is removed (was deprecated in v2). | ||
| - `resolve()` is now public (v2 had private `_resolve()`). | ||
|
|
||
| ```dart | ||
| // v2 | ||
| resource.update((state) => state); | ||
|
|
||
| // v3 | ||
| resource.state = ResourceState.ready(value); | ||
| ``` | ||
|
|
||
| ### 3.5 Utils removal | ||
|
|
||
| `solidart.dart` no longer exports: | ||
|
|
||
| - `Debouncer` / `DebounceOperation` | ||
| - `SolidartException`, `SolidartReactionException`, `SolidartCaughtException` | ||
| - `createDelayedScheduler` | ||
|
|
||
| If you relied on them, reimplement in your app or wrap them in a utility layer. | ||
|
|
||
| ## 4) Flutter integration (flutter_solidart) | ||
|
|
||
| - `ReadableSignal` removed; use `ReadonlySignal`. | ||
| - `ValueNotifierSignalMixin` is no longer exported. | ||
|
|
||
| Extensions changed: | ||
|
|
||
| - v2: `SignalBase.toValueNotifier()` and `ValueNotifier.toSignal()` | ||
| - v3: `ReadonlySignal.toValueNotifier()` and `ValueListenable.toSignal()` | ||
|
|
||
| ## 5) Hooks (solidart_hooks) | ||
|
|
||
| - `ReadSignal` → `ReadonlySignal` | ||
| - `equals/comparator` replaced by `equals: ValueComparator<T>` | ||
|
|
||
| Lifecycle change: | ||
|
|
||
| - v2: dispose on unmount only if `autoDispose` was true | ||
| - v3: hook-created signals are **always** disposed on unmount | ||
|
|
||
| Use `useExistingSignal(...)` to bind external signals without disposing them. | ||
|
|
||
| ## 6) Behavioral differences | ||
|
|
||
| - `SolidartConfig.autoDispose` default changed **true → false** | ||
| - `SolidartConfig.equals` removed | ||
| - `previousValue` updates only after a tracked read | ||
| - `LazySignal` throws if read before first assignment (check `isInitialized`) | ||
|
|
||
| ## 7) Quick migration checklist | ||
|
|
||
| - [ ] Upgrade versions in all solidart ecosystem packages | ||
| - [ ] Replace `ReadSignal`/`SignalBase` with `ReadonlySignal` | ||
| - [ ] Replace `toReadSignal()` with `toReadonly()` | ||
| - [ ] Remove `updateValue` usages (use `.value = ...`) | ||
| - [ ] Update Effect usage (no `delay/onError`, dispose via `.dispose()`) | ||
| - [ ] Update Resource state handling (`state =`, `when/maybeWhen`) | ||
| - [ ] Update Flutter extensions (`toValueNotifier`/`toSignal`) | ||
| - [ ] Adjust hooks disposal expectations | ||
medz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.