No description
Find a file
Scott Tolinski 04b9394089 tweaks build
2021-10-19 21:58:13 -06:00
codegen tweaks build 2021-10-19 21:58:13 -06:00
dist moves to monorepo 2021-10-06 15:41:44 -06:00
src moves to monorepo 2021-10-06 15:41:44 -06:00
.gitignore adds some actual code. not ready yet 2021-09-30 10:19:53 -06:00
codegen.tsconfig.json tweaks build 2021-10-19 21:58:13 -06:00
gQuery.png updates read me 2021-09-29 12:13:11 -06:00
package.json tweaks build 2021-10-19 21:58:13 -06:00
README.md updates gquery to work in prod 2021-10-13 11:06:31 -06:00
tsconfig.json updates gquery to work in prod 2021-10-13 11:06:31 -06:00

gQuery

qQuery

Not like jQuery. A GraphQL Fetcher & Cache for Svelte Kit

UnderConstruction.gif

More information in this space soon. API is very much in flux rn.

Preview

1. Initialize G

export const g = new GFetch({
	path: Environment.apiURL //whatever your api url is here
})

2. Add GraphQL Codegen Plugin

docs coming soon

3. Add Codegen Config

docs coming soon

4. Use that thang

<script context="module" lang="ts">
	// The generated function that fetches and caches
	import { getSeriesList } from '../whatever'

	export async function load() {
		// Runs the cache/fetch function populating $gCache before use.
		await getSeriesList({
			limit: 0
		})
		return {}
	}
</script>

<script lang="ts">
	// Cache becomes populated with data available for SSR
	import { gCache } from '@leveluptuts/g-query'

	// $: console.log($gCache.seriesList)
</script>

FAQ / WTF

Q? How tf do I update the cache?

It's a Svelte Writable Store. So after a mutation you can quickly and easily manually update the cache.

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 😼

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.