Skip to content

Commit

Permalink
Take LoadingType object union into account for FragmentStore
Browse files Browse the repository at this point in the history
  • Loading branch information
gwennlbh committed Nov 11, 2024
1 parent 7287f24 commit 921d993
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/olive-kangaroos-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'houdini-svelte': patch
---

Fragment store's \_Data parameter now takes into account the shape of @loading fragments' Fragment$data types
5 changes: 5 additions & 0 deletions .changeset/slimy-ducks-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'houdini': minor
---

Expose new type GraphQLLoadingObject that reflects the shape of @loading data
6 changes: 3 additions & 3 deletions packages/houdini-svelte/src/runtime/stores/fragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import cache from '$houdini/runtime/cache'
import { getCurrentConfig } from '$houdini/runtime/lib/config'
import { marshalInputs } from '$houdini/runtime/lib/scalars'
import type {
GraphQLObject,
FragmentArtifact,
HoudiniFetchContext,
GraphQLLoadingObject,
GraphQLVariables,
HoudiniFetchContext,
} from '$houdini/runtime/lib/types'
import { CompiledFragmentKind, fragmentKey } from '$houdini/runtime/lib/types'
import { derived } from 'svelte/store'
Expand All @@ -18,7 +18,7 @@ import { BaseStore } from './base'
// can't just return a store directly, the user has to load the version of the
// fragment store for the object the store has been mixed into
export class FragmentStore<
_Data extends GraphQLObject,
_Data extends GraphQLLoadingObject,
_ReferenceType extends {},
_Input extends GraphQLVariables = GraphQLVariables
> {
Expand Down
4 changes: 4 additions & 0 deletions packages/houdini/src/runtime/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ export type MutationOperation = {
when?: ListWhen
}

export type GraphQLLoadingObject = {
[key: string]: LoadingType | GraphQLLoadingObject | GraphQLValue
}

export type GraphQLObject = { [key: string]: GraphQLValue }

export type GraphQLDefaultScalar = string | number | boolean
Expand Down

0 comments on commit 921d993

Please sign in to comment.