Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query outside routes #95

Merged
merged 31 commits into from
Jun 16, 2021
Merged

Query outside routes #95

merged 31 commits into from
Jun 16, 2021

Conversation

AlecAivazis
Copy link
Collaborator

@AlecAivazis AlecAivazis commented Jun 13, 2021

This PR adds support for query in non-route components as well for applications that aren't using sapper or sveltekit. Along the way, I also added some configuration to decouple the module type from the framework being used in order to allow for users to opt out of esm if they're using kit, or opt-into them if they are using sapper. This should also add support for kit's SPA mode which builds a bare svelte app out of the project.

The easiest way to test this is to add the following block to the ItemEntry component in the example app:

	const {data: allItems, loading} = query(graphql`
			query ComponentAllItems { 
				items { 
					id
				}
			}
	`)
	$: if(!$loading) console.log($allItems)

closes #67, closes #85, closes #72

@pixelmund
Copy link
Contributor

Nice! I'm on vacation for the next 2 weeks so I won't have time to test it but it looks good to me so far.

@AlecAivazis AlecAivazis merged commit 1897cb1 into main Jun 16, 2021
@AlecAivazis AlecAivazis deleted the query-outside-routes branch June 16, 2021 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for SPA Mode Support query outside of pages and layouts Use without Sapper or SvelteKit
2 participants