-
Notifications
You must be signed in to change notification settings - Fork 229
Smnzhu/save tab #7253
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
base: main
Are you sure you want to change the base?
Smnzhu/save tab #7253
Conversation
/** | ||
* UserData instance to use for persisting workspace state | ||
*/ | ||
userData: IUserData<typeof WorkspacesStateSchema>; |
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.
Services shouldn't be used and passed around in views like that. This should be facilicated through the store
); | ||
|
||
useEffect(() => { | ||
savedWorkspacesPromiseRef.current.then( |
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.
This shouldn't be happening in render method, this logic belongs in the store
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.
I can move this
initialWorkspaceTabs, | ||
}: { initialWorkspaceTabs?: OpenWorkspaceOptions[] | null }, | ||
}: { | ||
userData: IUserData<typeof WorkspacesStateSchema>; |
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.
Services should be injected through service injection mechanism, not passed as props
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.
Can you elaborate on this one? What's service injection mechanism?
// Save to UserData with a fixed ID | ||
await userData.write('current-workspace', stateToSave); | ||
|
||
// Optional: Log for debugging in development |
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.
You should use logger service instead, we don't use console for logging (hence the eslint rule that disables it)
return this.cloudEndpoint(path); | ||
} | ||
userDataEndpoint(path?: string): string { | ||
return `https://cluster-connection.cloud-dev.mongodb.com/userData${normalizePath( |
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.
TODO: unhardcode this
Description
Screen.Recording.2025-09-17.at.11.48.12.AM.mov
TODO:
test ases:
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes