Skip to content
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

ref(ui): convert sentry app details to FC #86147

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ameliahsu
Copy link
Member

@ameliahsu ameliahsu requested a review from a team February 28, 2025 21:52
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Feb 28, 2025
@ameliahsu ameliahsu requested a review from natemoo-re February 28, 2025 21:53
this.setState({app: {...app, avatars}});
setApiQueryData(queryClient, SENTRY_APP_QUERY_KEY, {...app, avatars});
Copy link
Contributor

Choose a reason for hiding this comment

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

Q so does useApiQuery also serve as a useState for the parameters/data we extracted from the api call/useApiQuery does both api call + state management?

Then now when we're setting/updating the data from the api call, does that make another api call ? Or just do the state management piece/behave like the setter in useState

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe useApiQuery also serves as a useState. It doesn't make another API call, according to the docs setApiQueryData just updates the cached value

I used the account details form as an example 😳

const handleSubmitSuccess = (userData: User | ChangeAvatarUser) => {
// the updateUser method updates our Config Store
// No components listen to the ConfigStore, they just access it directly
updateUser(userData);
// We need to update the state, because AvatarChooser is using it,
// otherwise it will flick
setApiQueryData(queryClient, USER_ENDPOINT_QUERY_KEY, userData);
};

@ameliahsu ameliahsu marked this pull request as draft March 1, 2025 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants