updates readme

This commit is contained in:
Scott Tolinski 2021-10-22 09:32:33 -06:00
parent eb63167291
commit 0be3bfb2b3

View file

@ -59,7 +59,7 @@ This also gives us a `get` function for queries based on the query name. ie `get
```
<script context="module" lang="ts">
// The generated function that fetches and caches
import { getUser } from '../whatever'
import { getUser } from './UserQueries.gGenerated.graphql'
export async function load({fetch}) {
// Runs the cache/fetch function populating $gCache before use.
@ -86,10 +86,26 @@ This also gives us a `get` function for queries based on the query name. ie `get
It's a Svelte Writable Store. So after a mutation you can quickly and easily manually update the cache.
```
import { user, someMutation } from './UserQueries.gGenerated.graphql'
$user = null // clears the cache
$user = await someMutation({ variables }) // if this returns the correct data
```
### Q? Can't you update the cache magically for me after a mutation?
Maybe? If you want to be in charge of writing that bit, the door is open 😼
Maybe? If you want to be in charge of writing that bit, the door is open 😼. My idea for the api would look something like this.
```
import { user, someMutation } from './UserQueries.gGenerated.graphql'
await someMutation({ variables, store: user })
```
### Q? Why can't I use this yet?
It's changing too much rn, but will be available asap. Trust me, the sooner I get this done the better.
IT'S GETTING CLOSER