Repository navigation
Extract the common parts of the object-specific stores into a base class - #77
Merged
Merged
Conversation
…es into a base class
Deploying create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee with
|
| Latest commit: |
b7a8024
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c5f41d34.create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee.pages.dev |
| Branch Preview URL: | https://store-base.create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee.pages.dev |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Extract the parts shared by the five object-specific stores (components, nodes, component pins, node pins, and connections) into a new base class
CCBaseStoreinsrc/store/base.ts. This is a first step toward a GC-like mechanism that cleans up objects whose references are gone, which needs a single place that owns the objects of every store.CCBaseStoreholds:#storein each store becomes the protectedstore)#components,#nodes,#pins,#nodePins, and#connectionsbecome the protectedobjects)getandgetMany, which were identical in every storemountCCBaseStoreEvents, thedidRegister,willUnregister, anddidUnregisterevents that each store's event type now extendsregister,unregister, andimportstay in each store, as they still differ:unregistertakes a single id in some stores and an array in others, andimportbypassesregisterin the component pin and connection stores. No behavior changes.Validation:
npm run type-checknpm run checknpm test -- --runnpm run build