Skip to content

Commit

Permalink
Remove DropIndex, fix update user
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Mar 4, 2024
1 parent e53e139 commit 0bbd441
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 183 deletions.
165 changes: 0 additions & 165 deletions packages/play/app/components/drop_index.tsx

This file was deleted.

25 changes: 7 additions & 18 deletions packages/play/app/hooks/update_user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,16 @@ const userLikeAtom = atom<MinimalUser>({
*/
export function useUpdateMaybeUser() {
const [userLike, setUserLike] = useAtom(userLikeAtom);
const [updateUserOptionsMutation] = useMutation(updateUserOptions);
const [user, { setQueryData }] = useQuery(
getMaybeCurrentUser,
null,
AVOID_REFETCH
);

return {
user: user || userLike,
user: userLike,
setUser: async (param: Partial<MinimalUser>) => {
if (user) {
const updatedUser = await updateUserOptionsMutation(param);
void setQueryData(updatedUser, { refetch: false });
} else {
setUserLike((userLike) => {
return {
...userLike,
...param,
};
});
}
setUserLike((userLike) => {
return {
...userLike,
...param,
};
});
},
};
}

0 comments on commit 0bbd441

Please sign in to comment.