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

Take LoadingType object union into account for FragmentStore #1389

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ewen-lbh
Copy link
Contributor

@ewen-lbh ewen-lbh commented Nov 11, 2024

Fixes #1388

By defining new GraphQLLoadedValue & GraphQLLoadedObject types and including LoadingType in GraphQLValue's definition, every type in the library take could accept a loading value reflects this fact in its types. This allows typescript to infer things correctly

To help everyone out, please make sure your PR does the following:

  • Update the first line to point to the ticket that this PR fixes
  • Add a message that clearly describes the fix
  • If applicable, add a test that would fail without this fix
  • Make sure the unit and integration tests pass locally with pnpm run tests and cd integration && pnpm run tests
  • Includes a changeset if your fix affects the user with pnpm changeset

Copy link

changeset-bot bot commented Nov 11, 2024

🦋 Changeset detected

Latest commit: b846ed9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
houdini Minor
houdini-svelte Patch
houdini-react Patch
houdini-adapter-auto Patch
houdini-adapter-cloudflare Patch
houdini-adapter-node Patch
houdini-adapter-static Patch
houdini-plugin-svelte-global-stores Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

netlify bot commented Nov 11, 2024

Deploy Preview for houdini-docs-next canceled.

Name Link
🔨 Latest commit b846ed9
🔍 Latest deploy log https://app.netlify.com/sites/houdini-docs-next/deploys/6732105e0349b10008f6a709

Copy link

netlify bot commented Nov 11, 2024

Deploy Preview for houdinigraphql canceled.

Name Link
🔨 Latest commit b846ed9
🔍 Latest deploy log https://app.netlify.com/sites/houdinigraphql/deploys/6732105e4754190008222e01

@ewen-lbh ewen-lbh force-pushed the fix-fragment-store-type branch 2 times, most recently from 248b0e9 to 0775223 Compare November 11, 2024 13:09
@ewen-lbh

This comment was marked as outdated.

@ewen-lbh ewen-lbh force-pushed the fix-fragment-store-type branch 2 times, most recently from 59d390a to 5bcbc86 Compare November 11, 2024 13:57
net7toulouse pushed a commit to inp-net/churros that referenced this pull request Nov 11, 2024
export type GraphQLDefaultScalar = string | number | boolean

export type GraphQLValue = GraphQLDefaultScalar | null | GraphQLObject | GraphQLValue[] | undefined
export type GraphQLLoadedValue =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe i'm missing something but is there a problem with just updating GraphQLObject to always have the loaded value? If so, let's merge these 2 types with something like type GraphQLLoadedValue = GraphQLValue | LoadingType. Also, reading this outloud I think i would prefer a name like GraphQLValueWithLoading. a "loaded graphql value" sounds like it's already loaded (ie no loading values would be present).

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.

FragmentStore's _Data type argument does not accomodate @loading fragment's data shape
2 participants