Repository navigation
feat(runtime,vue): share MemoMap in makeAppRuntime and resolve AtomRegistry from context - #940
Merged
Merged
Conversation
…invalidateAndAwait
@effect-app/cli
effect-app
@effect-app/eslint-codegen-model
@effect-app/eslint-shared-config
@effect-app/infra
@effect-app/vue
@effect-app/vue-components
commit: |
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.
Why
makeAppRuntime/initializeAsync/initializeSyncineffect-app/runtimealways created a freshLayer.MemoMap, separate fromAtom.runtime'sMemoMap(defaultRegistry.get(Atom.runtime.memoMap)). CallingAtom.runtime.addGlobalLayer(globalLayers)therefore rebuilt layers a second time and leftAtom.withReactivitybound to a separateReactivityinstance from$runtimeandmakeClient.invalidateSoftandinvalidateAndAwaitin@effect-app/vuehardcodeddefaultRegistrywhen refreshing and awaiting query atoms instead of honoring anAtomRegistry.AtomRegistryservice provided in Effect context.What
packages/effect-app/src/runtime.ts: Accept optionaloptions?: { readonly memoMap?: Layer.MemoMap | undefined }inmakeAppRuntime,initializeSync, andinitializeAsync, forwarding{ memoMap }toManagedRuntime.makeso apps can sharedefaultRegistry.get(Atom.runtime.memoMap).packages/vue/src/atomQuery.ts: Resolve the active registry viaEffect.serviceOption(AtomRegistry.AtomRegistry)with fallback todefaultRegistryinsideinvalidateSoftandinvalidateAndAwait(preservingEffect.Effect<void>,R = never).packages/vue/src/makeClient.ts: Forward an optionalAtomRegistry.AtomRegistryfrommakeClient's base runtime context inmakeResolvedAtomQueryInvalidator.packages/vue/test/atomRegistryInvalidation.test.ts: Added 4 tests verifying isolatedAtomRegistryinvalidation (invalidateAndAwait+invalidateSoft),defaultRegistryfallback, and exact===sharedContext&Reactivityidentity acrossinitializeAsync(..., { memoMap }),makeAtomClientRuntime,Atom.runtime, andAtom.withReactivity..changeset/vue-atom-registry-context.md: Added patch changeset foreffect-appand@effect-app/vue.Verification
Full agent ship gate passed on
40f46d60c283:pnpm check(tsrs --build ./tsconfig.all.json)pnpm lint(pnpm -r lint)pnpm format:check(oxfmt --check)pnpm test(includingpackages/vue/test/atomRegistryInvalidation.test.ts, 4/4 passed)