-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
"Create screen" component context option #14255
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,11 +46,24 @@ | |
// Provide contexts | ||
setContext("sdk", SDK) | ||
setContext("component", writable({ id: null, ancestors: [] })) | ||
setContext("context", createContextStore()) | ||
|
||
const globalContext = createContextStore() | ||
setContext("context", globalContext) | ||
|
||
let dataLoaded = false | ||
let permissionError = false | ||
let embedNoScreens = false | ||
let cachedActiveScreenId | ||
|
||
// Clear component context entries from the global context | ||
// when the active page changes. | ||
const purgeGlobalComponentContext = screenId => { | ||
if (!screenId || cachedActiveScreenId == screenId) return | ||
cachedActiveScreenId = screenId | ||
globalContext.actions.clearComponentContext() | ||
} | ||
|
||
$: purgeGlobalComponentContext($screenStore?.activeScreen?._id) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand the purpose of this, but I think we should come up with a cleaner way of handling it than trying to whitelist all properties that we want to persist between screen changes. I have a few ideas in mind... For now I think it would be better to take this out of this PR as it's a separate issue, and we can tackle it elsewhere. |
||
|
||
// Determine if we should show devtools or not | ||
$: showDevTools = $devToolsEnabled && !$routeStore.queryParams?.peek | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than all this logic (some of which I know was pre-existing), we should use our
getSequentialName
utility which is designed to do exactly this!