Repository navigation
fix(app-graphql-playground): store playground tabs and history per tenant again - #5984
Conversation
…nant again The tenancy provider gives each tenant a child container with its own LocalStorage, prefixed by the tenant. The playground's repositories and presenters were root singletons. Under @webiny/di 1.x the first resolve came from the tenant container, so they used the tenant-prefixed storage. @webiny/di 2.0 (#5969) builds a singleton from its own container, the root, so tabs and query history went to the unprefixed root storage and were shared across tenants. PlaygroundRepository, QueryHistoryRepository and the two presenters that read them are now registered with inContainerScope(), so each tenant container builds its own against its own storage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🚓 Slop Cop ✅ Nothing worth flagging. The diff looks consistent with the PR's stated intent and the code-style rules. Small, focused fix changing four feature registrations from singleton to container scope, matching the stated intent; no integrity or style issues found. Automated, non-blocking heads-up from an LLM. It can be wrong — use your judgment. Regenerates on every push. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
The GraphQL playground's saved tabs and query history were shared across tenants, because both were written to the unprefixed root
localStorage.Cause
The tenancy provider gives each tenant a child container that registers its own
LocalStorage, prefixed with the tenant (app-admin/src/features/tenancy/feature.ts). The playground's two repositories and the two presenters that read them were root singletons. Under@webiny/di1.x, the first resolve came from the tenant container, so they used the tenant-prefixed storage.@webiny/di2.0 (#5969) builds a singleton from the container that registers it, here the root. Tabs went towebiny/<id>:graphql-playgroundinstead ofwebiny/<id>/<tenant>:graphql-playground, and the same happened to the history.Fix
PlaygroundRepository,QueryHistoryRepository,PlaygroundPresenterandQueryHistoryPresenterare registered withinContainerScope(). Each tenant container builds its own instances against its own storage. Within one container, the two presenters still share the oneQueryHistoryRepository. Nothing else depends on these four. The tab registry and the client factories don't touch storage, so they stay root singletons.The other root singletons that use
LocalStoragestore global state: the current tenant, assumed permissions, the WCP licence cache, feature flags and the installed flag. They were resolved from the root under 1.x too, so nothing changed for them.Anything saved since #5969 sits under the root key and won't appear after this change. Data saved before #5969 is under the tenant key and shows again.
Testing
app-graphql-playgroundtests pass (6 files, 101 tests).yybbuilds.webiny/<id>:graphql-playgroundbefore this change. After it, it writeswebiny/<id>/root:graphql-playgroundandwebiny/<id>/root:graphql-playground-history. An added tab survives a reload, and running a query saves history.Workspace: wby-next2 · 🧹 MERGE 6.5.0 => NEXT
🤖 Generated with Claude Code
Summary by CodeRabbit