From 816813c0ebad9efc16372c577a6fbe3c5c78752f Mon Sep 17 00:00:00 2001 From: Juerg Hunziker Date: Fri, 6 Oct 2023 10:55:37 +0200 Subject: [PATCH 1/3] fix type of loadresult variables --- e2e/kit/src/lib/utils/routes.ts | 1 + .../+page.svelte | 24 +++++++++++++++++++ .../+page.ts | 6 +++++ .../spec.ts | 11 +++++++++ packages/houdini-svelte/src/runtime/index.ts | 3 ++- 5 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 e2e/kit/src/routes/stores/ssr-loadall-store-without-variables/+page.svelte create mode 100644 e2e/kit/src/routes/stores/ssr-loadall-store-without-variables/+page.ts create mode 100644 e2e/kit/src/routes/stores/ssr-loadall-store-without-variables/spec.ts diff --git a/e2e/kit/src/lib/utils/routes.ts b/e2e/kit/src/lib/utils/routes.ts index 5638744b8e..6794aca495 100644 --- a/e2e/kit/src/lib/utils/routes.ts +++ b/e2e/kit/src/lib/utils/routes.ts @@ -34,6 +34,7 @@ export const routes = { Stores_Mutation_Scalar_Multi_Upload: '/stores/mutation-scalar-multi-upload', Stores_Mutation_Enums: '/stores/mutation-enums', Stores_Network_One_Store_Multivariables: '/stores/network-one-store-multivariables', + Stores_SSR_LoadAll_Store_Without_Variables: '/stores/ssr-loadall-store-without-variables', Stores_SSR_One_Store_Multivariables: '/stores/ssr-one-store-multivariables', Stores_Fragment_Null: '/stores/fragment-null', Stores_Metadata: '/stores/metadata', diff --git a/e2e/kit/src/routes/stores/ssr-loadall-store-without-variables/+page.svelte b/e2e/kit/src/routes/stores/ssr-loadall-store-without-variables/+page.svelte new file mode 100644 index 0000000000..7335cc2fb7 --- /dev/null +++ b/e2e/kit/src/routes/stores/ssr-loadall-store-without-variables/+page.svelte @@ -0,0 +1,24 @@ + + +

ssr-loadall-store-without-variables

+ +
+ {$Hello.data?.hello} +
+ +
+ {checkTypes()} +
diff --git a/e2e/kit/src/routes/stores/ssr-loadall-store-without-variables/+page.ts b/e2e/kit/src/routes/stores/ssr-loadall-store-without-variables/+page.ts new file mode 100644 index 0000000000..07b62b4e81 --- /dev/null +++ b/e2e/kit/src/routes/stores/ssr-loadall-store-without-variables/+page.ts @@ -0,0 +1,6 @@ +import { load_Hello, loadAll } from '$houdini'; +import type { LoadEvent } from '@sveltejs/kit'; + +export async function load(event: LoadEvent) { + return await loadAll(load_Hello({ event })); +} diff --git a/e2e/kit/src/routes/stores/ssr-loadall-store-without-variables/spec.ts b/e2e/kit/src/routes/stores/ssr-loadall-store-without-variables/spec.ts new file mode 100644 index 0000000000..6746237d82 --- /dev/null +++ b/e2e/kit/src/routes/stores/ssr-loadall-store-without-variables/spec.ts @@ -0,0 +1,11 @@ +import { test } from '@playwright/test'; +import { routes } from '../../../lib/utils/routes.js'; +import { expect_to_be, goto } from '../../../lib/utils/testsHelper.js'; + +test.describe('ssr-loadall-store-without-variables Page', () => { + test('loadAll should brings correct types', async ({ page }) => { + await goto(page, routes.Stores_SSR_LoadAll_Store_Without_Variables); + + await expect_to_be(page, 'true', 'div[id=result-types]'); + }); +}); diff --git a/packages/houdini-svelte/src/runtime/index.ts b/packages/houdini-svelte/src/runtime/index.ts index f598be3c58..7f4f494869 100644 --- a/packages/houdini-svelte/src/runtime/index.ts +++ b/packages/houdini-svelte/src/runtime/index.ts @@ -1,3 +1,4 @@ +import type { GraphQLVariables } from '$houdini/runtime/lib/types' import type { QueryStore } from './stores' export * from './adapter' @@ -6,7 +7,7 @@ export * from './fragments' export * from './session' export * from './types' -type LoadResult = Promise<{ [key: string]: QueryStore }> +type LoadResult = Promise<{ [key: string]: QueryStore }> type LoadAllInput = LoadResult | Record // gets all the values from an object From 33b02315c5ab673cdedb942d3eee33d63da1f4c6 Mon Sep 17 00:00:00 2001 From: Juerg Hunziker Date: Fri, 6 Oct 2023 11:13:28 +0200 Subject: [PATCH 2/3] add changeset --- .changeset/soft-toes-learn.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/soft-toes-learn.md diff --git a/.changeset/soft-toes-learn.md b/.changeset/soft-toes-learn.md new file mode 100644 index 0000000000..2d23ac8de1 --- /dev/null +++ b/.changeset/soft-toes-learn.md @@ -0,0 +1,5 @@ +--- +'houdini-svelte': patch +--- + +Fix typings of loadAll() function From a528d82a85eb7af4235591ae150f671cc2084b20 Mon Sep 17 00:00:00 2001 From: Juerg Hunziker Date: Sat, 7 Oct 2023 21:24:18 +0200 Subject: [PATCH 3/3] fix linting issues --- .../stores/ssr-loadall-store-without-variables/+page.svelte | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/e2e/kit/src/routes/stores/ssr-loadall-store-without-variables/+page.svelte b/e2e/kit/src/routes/stores/ssr-loadall-store-without-variables/+page.svelte index 7335cc2fb7..f8fb19f3a4 100644 --- a/e2e/kit/src/routes/stores/ssr-loadall-store-without-variables/+page.svelte +++ b/e2e/kit/src/routes/stores/ssr-loadall-store-without-variables/+page.svelte @@ -7,9 +7,7 @@ $: ({ Hello } = data); const checkTypes = () => { - return ( - `${data.Hello instanceof HelloStore}` - ); + return `${data.Hello instanceof HelloStore}`; };