Make color scheme optimistically udpated (#745)
This commit is contained in:
@ -36,6 +36,22 @@ export function useColorScheme() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
optimisticResponse:
|
||||||
|
currentUser && currentUser.settings
|
||||||
|
? {
|
||||||
|
__typename: 'Mutation',
|
||||||
|
updateUser: {
|
||||||
|
__typename: 'User',
|
||||||
|
...currentUser,
|
||||||
|
settings: {
|
||||||
|
__typename: 'UserSettings',
|
||||||
|
id: currentUser.settings.id,
|
||||||
|
colorScheme: value,
|
||||||
|
locale: currentUser.settings.locale,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!result.data || result.errors) {
|
if (!result.data || result.errors) {
|
||||||
@ -43,7 +59,7 @@ export function useColorScheme() {
|
|||||||
}
|
}
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
},
|
},
|
||||||
[currentUser?.id, updateUser],
|
[currentUser, updateUser],
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user