-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't run setup on queries without load (#1068)
- Loading branch information
1 parent
5f3bc42
commit 7e30f68
Showing
8 changed files
with
83 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'houdini-svelte': patch | ||
--- | ||
|
||
Fix bug with lazy component queries causing them to subscribe to the cache before fetching |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
e2e/kit/src/routes/stores/component_no_load_no_setup/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<script lang="ts"> | ||
import { graphql } from '$houdini'; | ||
const q1 = graphql(` | ||
query q1 @load { | ||
cities { | ||
name | ||
} | ||
} | ||
`); | ||
const q2 = graphql(` | ||
query q2 { | ||
city(id: 1) { | ||
name | ||
} | ||
} | ||
`); | ||
const q3 = graphql(` | ||
query q3 { | ||
city(id: 1) { | ||
name | ||
} | ||
} | ||
`); | ||
</script> | ||
|
||
<div> | ||
<h3>query 1</h3> | ||
<pre> | ||
{JSON.stringify($q1.data, null, 2)} | ||
</pre> | ||
</div> | ||
|
||
<div> | ||
<h3>query 2</h3> | ||
<pre> | ||
{JSON.stringify($q2.data, null, 2)} | ||
</pre> | ||
<button id="load2" on:click={() => q2.fetch()}>Run</button> | ||
</div> | ||
|
||
<h3>query 3</h3> | ||
<div id="result"> | ||
{JSON.stringify($q3.data, null, 2)} | ||
</div> | ||
<button on:click={() => q3.fetch()}>Run</button> |
18 changes: 18 additions & 0 deletions
18
e2e/kit/src/routes/stores/component_no_load_no_setup/spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { test } from '@playwright/test'; | ||
import { routes } from '../../../lib/utils/routes.js'; | ||
import { expect_to_be, goto } from '../../../lib/utils/testsHelper.js'; | ||
import { sleep } from '@kitql/helper'; | ||
|
||
test("Components without load shouldn't subscribe to the cache", async ({ page }) => { | ||
await goto(page, routes.Stores_Component_no_load_no_setup); | ||
|
||
await expect_to_be(page, 'null'); | ||
|
||
// click on the button | ||
await page.click('#load2'); | ||
|
||
await sleep(100); | ||
|
||
// make sure we still have null as the value | ||
await expect_to_be(page, 'null'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters