houdini icon indicating copy to clipboard operation
houdini copied to clipboard

Example error in documentation

Open yasserlens opened this issue 3 years ago • 1 comments
trafficstars

Describe the bug

Hello!

Please update the docs below - the example given has an incorrect object passed into the fetch fn: https://www.houdinigraphql.com/api/query#manual-loading

import { MyQueryStore } from '$houdini'

export async function load(event) {
	const MyQuery = new MyQueryStore()

        // Next line should have MyQuery.fetch({event}) instead.
	const result = await MyQuery.fetch(event)

	console.log('do something with', result)

	return { MyQuery }
}

This is to satisfy the check on the following line: https://github.com/HoudiniGraphql/houdini/blob/cd00b5f436412ecc3ac2225d2ee8a9201b172da0/src/runtime/stores/query.ts#L406

Severity

serious, but I can work around it

Steps to Reproduce the Bug

Run the example code above, it won't work. The object passed in fetch needs to be {event} not event.

Reproduction

No response

yasserlens avatar Sep 21 '22 11:09 yasserlens

Thanks for opening this @yasserlens!

Would you mind submitting a PR with the fix? i'm a bit busy for the next few days

AlecAivazis avatar Sep 21 '22 17:09 AlecAivazis

This has now been fixed.

AlecAivazis avatar Oct 21 '22 16:10 AlecAivazis