Open pospi opened 1 year ago
Also to note that in my testing the getCurrentResult()
-> refetch()
dance does not seem to be necessary.
If the component needs to run additional logic after a query has first executed, this should work fine:
const GET_UNITS = gql`/* ... */`
const getUnits: ReadableQuery<UnitsQueryResponse> = query(GET_UNITS)
onMount(async () => {
const units = await getUnits.refetch()
// do stuff with `units`
})
Many components (
resource_specifications/+page.svelte
as an example) have multiplequery()
bindings in them which could be combined into a singularquery()
which requests all dependent data in its entirety. In the case of this example,resourceSpecifications
andGetUnits
could be combined by simply listing them one after the other inside a singlequery {}
block.We should check over the codebase for these and merge as appropriate since it will simplify initialisation logic and lead to increased cache utilisation by the GraphQL query backend (ie. fewer calls to Holochain needed).