update Markdown skills
This commit is contained in:
@@ -42,13 +42,21 @@ export function usePreferences() {
|
||||
return { ...base44.auth.preferences(), ...(user?.preferences || {}) };
|
||||
}
|
||||
|
||||
/** Writes one or more preferences and refreshes every consumer of `['user']`. */
|
||||
/**
|
||||
* Writes one or more preferences and refreshes every consumer of `['user']`.
|
||||
*
|
||||
* The mutation resolves to `{ user, persisted, error }`, not to the user — a
|
||||
* caller storing something it needs back after a reload, which is every caller
|
||||
* writing `customSkills`, has to be able to tell a write that landed from one
|
||||
* the browser refused. The cache is updated either way: the change is real for
|
||||
* this session even when it could not be stored.
|
||||
*/
|
||||
export function useUpdatePreferences() {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: /** @param {any} patch */ (patch) => base44.auth.updatePreferences(patch),
|
||||
onSuccess: (user) => {
|
||||
queryClient.setQueryData(['user'], user);
|
||||
onSuccess: /** @param {any} result */ (result) => {
|
||||
queryClient.setQueryData(['user'], result.user);
|
||||
queryClient.invalidateQueries({ queryKey: ['user'] });
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user