-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
[question] how to capture query response into a variable? #96
Comments
|
@narutaro Thanks for your suggestion. However "books" still remains a promise. Basically I want to make things synchronous.
|
I usually do like this:
|
How would you be able to update the This is when I do something like a |
@ZerdoX-x Never mind - answered my own question but ty for pointing the right direction. Not sure if this is the only way but it's not lucrative but works:
|
You can't update this variable because this is the cache from graphql. Response from your server stored in cache as source of truth |
Was able to change it by taking your approach with the |
Then why not <script>
import { query } from "svelte-apollo";
import { QUERY_SOME_DATA } from "./queries";
const querySomeData = query(QUERY_SOME_DATA);
$: someData = Object.assign({ }, $querySomeData.data?.shippingMethodMapping);
</script> ? |
While it does render the value to the input, it somehow doesn't allow you to even type in the field. No console errors are being generated as well ¯_( ツ )_/¯. |
In the example code you can use {#if ..} to wait for the query result.
However, this obviously only works in the html part.
I've tried async/await to capture the result in to a variable but that doesn't work.
Any suggestions?
The text was updated successfully, but these errors were encountered: