Skip to content
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

DEV: Add a way to observe stores #1307

Merged
merged 4 commits into from
Nov 11, 2022
Merged

Conversation

thetarnav
Copy link
Contributor

@thetarnav thetarnav commented Oct 23, 2022

  • Adds a dev-only ability to observe stores by adding a new $ON_UPDATE symbol.
  • the dev APIs are bundled into a DEV object, as in the core module (not sure if it should be called STORE_DEV to avoid conflicts, but it's probably whatever)
  • Some typings got cleaned up too (nothing in public APIs though)
  • Added a jsdoc comment to unwrap because why not

Draft because I still want to confirm if this is enough, and maybe add some unit tests.

Adds a dev-only ability to observe stores by adding a new `$ON_UPDATE` symbol.
Add off the dev APIs are bundled into DEV object, as in core module
Some typings got impored too
Added a jsdoc comment to `unwrap` as well
@coveralls
Copy link

coveralls commented Oct 23, 2022

Pull Request Test Coverage Report for Build 3388525518

  • 11 of 11 (100.0%) changed or added relevant lines in 3 files are covered.
  • 14 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.06%) to 89.15%

Files with Coverage Reduction New Missed Lines %
packages/solid/store/src/store.ts 1 95.99%
packages/solid/src/render/component.ts 13 71.52%
Totals Coverage Status
Change from base Build 3287627654: 0.06%
Covered Lines: 1284
Relevant Lines: 1370

💛 - Coveralls

@thetarnav thetarnav marked this pull request as ready for review November 3, 2022 19:27
@thetarnav
Copy link
Contributor Author

thetarnav commented Nov 3, 2022

Alright, I think this one's ready
I've changed the API to use a global listener, similar to the existing afterUpdate and afterRootCreate hooks.
This will allow for more flexibility and storing updates without pre-patching anything.

@ryansolid ryansolid merged commit 40d6db6 into solidjs:main Nov 11, 2022
@thetarnav thetarnav deleted the observe-stores branch November 11, 2022 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants