| name | update-preact |
| description | Instructions and guidelines for updating the pinned Preact JS git submodule and synchronizing upstream updates to the Dart preact_signals package. |
Updating Preact JS Submodule and preact_signals Package
This guide details the systematic process for updating the pinned Preact.js Signals JS/TS git submodule (third_party/preactjs_signals) and porting its structural updates, algorithmic changes, and optimizations into the Dart preact_signals package.
1. Upstream Submodule Management
The upstream JavaScript/TypeScript implementation is tracked via a Git submodule located at third_party/preactjs_signals.
A. Initializing and Synchronizing the Submodule
If the submodule is not initialized, run:
git submodule update --init --recursive
B. Pinned Submodule Version Upgrade
To upgrade the pinned submodule version:
- Navigate to the submodule directory:
cd third_party/preactjs_signals
- Fetch all latest upstream branches and tags:
git fetch --tags origin
- Checkout the desired release tag or commit hash:
git checkout tags/v1.3.0
- Return to the root workspace directory and stage the updated submodule pointer:
cd ...
git add third_party/preactjs_signals
2. Reviewing Upstream Core Architecture Changes
Once the submodule is checked out to the new version, review the differences inside Preact's TypeScript core codebase:
Compare changes to locate:
- Algorithmic Optimizations: Refinements in graph tracking, batch processing, or lazy evaluation cycles.
- Bug Fixes: Handling of edge-case memory leaks, exception propagates, or subscription-tracking re-entrancy issues.
- API Contracts: New methods or configuration parameters added to
Signal, Computed, or Effect.
3. Porting Changes to Dart preact_signals
All ported logic must reside in the packages/preact_signals package.
A. Code Synchronization
Modify the corresponding Dart implementation files to accurately align with the updated Preact JS algorithms:
[!IMPORTANT]
Keep the Dart implementation highly semantic and idiomatic. While replicating Preact's structural logic is necessary to preserve reactive correctness and avoid cycles, leverage Dart's language features (such as late initializers, WeakReference, Expando, or Extension types) appropriately.
B. Porting Upstream Tests
Ensure any new test cases introduced in Preact core's test suite are ported to:
4. Package Release & Changelog Alignment
When changes are ported, increment package versions and document changes.
- Semantic Versioning: Increase the version in packages/preact_signals/pubspec.yaml based on whether changes are major (breaking changes), minor (features), or patch (bug fixes).
- Changelog Documentation: Document all changes and the specific upstream version tag synced in packages/preact_signals/CHANGELOG.md.
5. Verification Checklist
Execute these verification commands prior to staging code changes:
melos bootstrap
melos run analyze
dart format .
melos run test
melos run coverage