Skip to content

Org settings partial updates improvements #20626

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

Merged
merged 5 commits into from
Feb 25, 2025

Conversation

filiptronicek
Copy link
Member

@filiptronicek filiptronicek commented Feb 24, 2025

Description

This PR contains the following fixes on top of #20603:

  • Cleaning up frontend for partial updates to org settings
  • Fixing a bug with public api shape conversion to make partial updates work for org welcome messages
  • Shift resolving of avatars to a special resolveWelcomeMessage fn
  • When updating org settings, we get the new data back in the response. We used to throw it out and re-fetch fresh data, which was wasteful. Now, we just set the org setting query's data to the data we get from the update mutation.

The existing caveat that this doesn't tackle (and that I realized just now) is that when you delete your user account, the featured member won't be un-set. This is fine for now though, since nothing breaks, just the avatar shows an empty image.

How to test

https://ft-gpl-org7e7f3fc03d.preview.gitpod-dev.com/settings/onboarding

/hold

Tool: gitpod/catfood.gitpod.cloud

fix for getting settings (also resolve avatar)

Tool: gitpod/catfood.gitpod.cloud
The hack was introduced in #20620

- Update welcome message configuration to handle optional enabled field
- Simplify welcome message update logic in various components
- Modify protobuf definitions to make enabled field optional
- Remove redundant checks and simplify type handling in converters and components

Tool: gitpod/catfood.gitpod.cloud
@filiptronicek filiptronicek force-pushed the ft/gpl/org-settings-refresh branch from 3334f6d to 8b563ec Compare February 24, 2025 16:45
@filiptronicek filiptronicek changed the title Separate feature member avatar resolution to new method Org settings partial updates improvements Feb 24, 2025
@@ -27,13 +28,12 @@ export type SuggestedOrgRepository = PlainMessage<SuggestedRepository> & {

export function useOrgSuggestedRepos() {
const organizationId = useCurrentOrg().data?.id;
const orgSettings = useOrgSettingsQuery();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧡

Tool: gitpod/catfood.gitpod.cloud
invalidateWorkspaceClasses();
invalidateOrgRepoSuggestions();

if (settings) {
queryClient.setQueryData(getQueryKey(organizationId), settings);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this set's the query's data to not have to re-fetch data we have available to us. We do the same with updating Configurations

@@ -26,7 +26,7 @@ export const OrgMemberAvatarInput = ({ settings, setFeaturedMemberId }: Props) =
const handleSelectionChange = useCallback(
(selectedId: string) => {
const member = members?.find((m) => m.userId === selectedId);
setFeaturedMemberId(selectedId || undefined);
setFeaturedMemberId(selectedId);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was necessary to force the default value and not just make an empty update.

Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM! 🙏

@filiptronicek filiptronicek requested a review from geropl February 25, 2025 09:25
Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️ again

@filiptronicek filiptronicek merged commit f36f3a1 into gpl/org-settings-refresh Feb 25, 2025
32 of 33 checks passed
@filiptronicek filiptronicek deleted the ft/gpl/org-settings-refresh branch February 25, 2025 09:39
geropl added a commit that referenced this pull request Feb 25, 2025
Tool: gitpod/catfood.gitpod.cloud
geropl added a commit that referenced this pull request Feb 25, 2025
Tool: gitpod/catfood.gitpod.cloud
roboquat pushed a commit that referenced this pull request Feb 25, 2025
* [api, server, dashboard] Cleanup UpdateOrganizationSettings API

Tool: gitpod/catfood.gitpod.cloud

* Org settings partial updates improvements (#20626)

Tool: gitpod/catfood.gitpod.cloud

* review comment

Tool: gitpod/catfood.gitpod.cloud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants