Support query outside of pages and layouts
See original GitHub issueI have not yet had success with fetch queries to my remote graphql server (Hasura). I’m getting a Cannot read property 'data' of undefined
error, and after adding logging to the environment.js my best guess is that it’s not even attempting to fetch since the logging isn’t appearing. I’m not clear on the best way to debug this issue, and am hoping a solution here will help others.
My query is adapted straight from the documentation:
import { query, graphql, AllUsers } from '$houdini';
const { data } = query<AllUsers>(graphql`
query AllUsers {
kl_users {
email
uid
}
}
`);
and the error is:
Cannot read property 'data' of undefined
TypeError: Cannot read property 'data' of undefined
at Module.query (/$houdini/runtime/query.js:15:48)
at Login.svelte:33:29
at Object.$$render (<PATH>/node_modules/svelte/internal/index.js:1380:22)
at eval (/src/lib/layout/Header.svelte:15:115)
at Object.$$render (<PATH>/node_modules/svelte/internal/index.js:1380:22)
at eval (<PATH>/src/routes/$layout.svelte:42:94)
at Object.$$render (<PATH>/node_modules/svelte/internal/index.js:1380:22)
at root.svelte:31:44
at $$render (<PATH>/node_modules/svelte/internal/index.js:1380:22)
at Object.render (<PATH>/node_modules/svelte/internal/index.js:1388:26)
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (2 by maintainers)
Top Results From Across the Web
Using Page Definition Queries—Help | ArcGIS for Desktop
Page Definition Queries allow you to specify which features of a layer draw based on an SQL query. Though similar to other definition...
Read more >Using feature queries - CSS: Cascading Style Sheets | MDN
Feature queries are created using the CSS at-rule @supports, and are useful as they give web developers a way to test to see...
Read more >query or filter fields of page layouts. - Salesforce Developers
query or filter fields of page layouts. Hi, There are almost 500 fields in Accounts and Iam trying to delete the fields of...
Read more >Guide to designing reports - Microsoft Support
In this article. Decide how to lay out your report. Use control layouts to align your data. Add or remove report or page...
Read more >Finding out which page layouts are available for an object with ...
The Tooling API is your friend here. You can make a call to /services/data/v33.0/tooling/query/ and query the layouts per object.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@thormuller I ran into something interseting while debugging this - if I change
/src/routes/qry/index.svelte
to look likeThen I see the query being fired and a result is rendered. I’m going to keep poking at this to see if i can figure out the difference between this page the
Login
component but at least there is some progress.edit: Whoops wrong button!
@thormuller I think I have a working update to support
query
in a component outside ofsrc/routes
. Mind pulling down #95 and giving it a shot?