Skip to main content
100%

Gist 7a1d4b8b5a6131f80d2efea29621dc45

✓ Published0🌍 Public
MMattDionis
Last edited May 24, 2019
Created on May 24, 2019

This code snippet shows a GraphQL mutation handler for updating an application's bar color setting. It uses Apollo Client’s `useMutation` hook, sending `UPDATE_APP_BAR_COLOR_SETTING_MUTATION` with a `setting` variable. After the mutation, it reads the current `appBarColorSetting` from the cache using `APP_BAR_COLOR_SETTING_QUERY`, modifies the setting, and writes the updated data back via `cache.writeQuery`. The example demonstrates optimistic cache updates for UI preferences.

AI-generated description

Similar vizzes