ngxs / store

🚀 NGXS - State Management for Angular
http://ngxs.io
MIT License
3.53k stars 400 forks source link

feat(storage-plugin): require explicit options when providing storage plugin #2100

Closed arturovt closed 7 months ago

arturovt commented 7 months ago

This commit updates the implementation of the register signature for the storage plugin. It now always requires options to be provided. We want to ensure clarity regarding the states that we're going to serialize. When no options are provided, we implicitly provide the @@STATE key, which defines that all states should be serialized. This implementation doesn't compromise extendability because we implicitly rely on the internal mechanism that transforms options. We should always require options to be provided and require developers to specify serializable states explicitly.

This would allow us to have feature states because the feature registration mechanism would also know if the user explicitly specified all states to be serialized at the root level or not.

Note: This change is breaking. However, it's time to make breaking changes to move forward, as the current implementation is stale and acts as a blocker.

nx-cloud[bot] commented 7 months ago

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 05e965c7de86a29469701c75025e5aa91cf9cf03. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 4 targets - [`nx run-many --target=test --all --configuration=ci --maxWorkers=4`](https://cloud.nx.app/runs/plosZntGX3?utm_source=pull-request&utm_medium=comment) - [`nx lint-types store`](https://cloud.nx.app/runs/A7A0AAgna0?utm_source=pull-request&utm_medium=comment) - [`nx run-many --target=lint --all`](https://cloud.nx.app/runs/TRZpsNIN98?utm_source=pull-request&utm_medium=comment) - [`nx run-many --target=build --all`](https://cloud.nx.app/runs/AwIXZ2C6dh?utm_source=pull-request&utm_medium=comment)

Sent with 💌 from NxCloud.

bundlemon[bot] commented 7 months ago

BundleMon (Integration Projects)

Files updated (2) Status | Path | Size | Limits :------------: | ------------ | :------------: | :------------: :white_check_mark: | Main bundles(Gzip)
hello-world-ng16/dist-integration/main.(hash)
.js
| 65.92KB (+12B +0.02%) | +1% :white_check_mark: | Main bundles(Gzip)
hello-world-ng17/dist-integration/main.(hash)
.js
| 67.41KB (+12B +0.02%) | +1%

Total files change +24B +0.02%

Final result: :white_check_mark:

View report in BundleMon website ➡️


Current branch size history | Target branch size history

codeclimate[bot] commented 7 months ago

Code Climate has analyzed commit 05e965c7 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 95.5% (0.0% change).

View more on Code Climate.

arturovt commented 7 months ago

LGTM

@arturovt Should we plan to add a migration schematics to ease the impact of these breaking changes?

Yeah, I talked to @profanis .