-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
🪟 🐛 🧹 Fix workspace editing issues in cloud, cleanup CloudWorkspacesService #16942
Conversation
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.
Have not had a chance to test locally but left a few comments.
airbyte-webapp/src/packages/cloud/services/workspaces/CloudWorkspacesService.tsx
Outdated
Show resolved
Hide resolved
const removeWorkspace = useRemoveWorkspace(); | ||
const updateWorkspace = useUpdateWorkspace(); | ||
const removeCloudWorkspace = useRemoveCloudWorkspace(); | ||
const updateCloudWorkspace = useUpdateCloudWorkspace(); |
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 think typically we do something like:
const updateCloudWorkspace = useUpdateCloudWorkspace(); | |
const { mutateAsync: updateCloudWorkspace } = useUpdateCloudWorkspace(); |
export const WorkspaceSettingsView: React.FC = () => { | ||
const { formatMessage } = useIntl(); | ||
useTrackPage(PageTrackingCodes.SETTINGS_WORKSPACE); | ||
const { exitWorkspace } = useWorkspaceService(); | ||
const workspace = useCurrentWorkspace(); | ||
const removeWorkspace = useRemoveWorkspace(); | ||
const updateWorkspace = useUpdateWorkspace(); | ||
const removeCloudWorkspace = useRemoveCloudWorkspace(); |
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.
const removeCloudWorkspace = useRemoveCloudWorkspace(); | |
const const { mutateAsync: removeCloudWorkspace, isLoading } = = useRemoveCloudWorkspace(); |
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.
Code LGTM, have not tested locally.
Use i18n string sin WorkspaceSettingsView buttons
…nfusion with WorkspaceService Update functions in CloudWorkspacesServices to include the word Cloud
c6f5cec
to
cc7d002
Compare
…ervice (airbytehq#16942) * Add validation to WorkspaceSettingsView Use i18n string sin WorkspaceSettingsView buttons * Invalidate the workspace query when updating the workspace in cloud * Rename Cloud WorkspacesService to CloudWorkspacesServices to avoid confusion with WorkspaceService Update functions in CloudWorkspacesServices to include the word Cloud * useInvalidateWorkspaceQuery -> useInvalidateWorkspace * Remove useWorkspaceService import from CloudWorkspacesService * Update var names using CloudWorkspacesService * Rename useGetUsage to useGetCloudWorkspaceUsage * tsx -> ts * Cleanup mutateAsync usage around CloudWorkspacesService hooks * Remove reference to CloudWorkspacesServices in ConnectionFormService test
…ervice (airbytehq#16942) * Add validation to WorkspaceSettingsView Use i18n string sin WorkspaceSettingsView buttons * Invalidate the workspace query when updating the workspace in cloud * Rename Cloud WorkspacesService to CloudWorkspacesServices to avoid confusion with WorkspaceService Update functions in CloudWorkspacesServices to include the word Cloud * useInvalidateWorkspaceQuery -> useInvalidateWorkspace * Remove useWorkspaceService import from CloudWorkspacesService * Update var names using CloudWorkspacesService * Rename useGetUsage to useGetCloudWorkspaceUsage * tsx -> ts * Cleanup mutateAsync usage around CloudWorkspacesService hooks * Remove reference to CloudWorkspacesServices in ConnectionFormService test
What
Fixes #16149
This change primarily fixes some issues when editing the cloud workspace name and advanced mode, including:
Also cleans up the cloud workspace code to distinguish it from the workspace code
How
There are two endpoints for getting workspace data: One from the platform and one specific to cloud. The issue when saving the workspace name in cloud was that the workspace data for the platform was not getting invalidated (since it's cached with react-query), and so the name was not getting updated across the app. When the cloud workspace data is updated, the platform workspace data is invalidated, so it's re-fetched.
Additionally, some of the cache keys used with suspenseQuery were not quite matching, so those were fixed. Caused by #11746
There was a lot of mixup in the cloud between what's cloud workspace and platform workspace, so a lot of the functions have been renamed so that it's clear which is which.
Recommended reading order
WorkspaceSettingsView.tsx
CloudWorkspacesService.ts
WorkspacesService.ts
Rest of code