-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Merge fehnomenal's work (#507) * Allow passing session data to the fetch function * Prefer the client side session * Receive the server session only in the browser * Separate client and server sessions more clearly * make test more resilient * fake root layout file * fake +layout.server.js * kit transform threads session from +layout.server.js to client * remove client.init Co-authored-by: Andreas Fehn <[email protected]> * rename setServerSession to setSession * receiving server session data needs to be reactive * document no more init * update authentication guide * auth guide tweaks * use App.Session for SessionData * remove document proxy * added integration test for session * make checker happy * add changeset * remove unused import * fix inconsistent absolutely path in CI * tweak util names * find_exported_fn considers export const * better support for load functions with implicit returns * track hydrated state in root layout * pass session to client side operations (mutations, loadNextPage, etc) * updated snapshots * add log if no session in locals * block on error * document onError blocking * update snapshot * fix duplicate test name Co-authored-by: Andreas Fehn <[email protected]>
- Loading branch information
1 parent
4983a76
commit 60ecb33
Showing
58 changed files
with
1,075 additions
and
530 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': patch | ||
--- | ||
|
||
added support for sessions |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
export function getSession() { | ||
return { | ||
token: '1234-Houdini-Token-5678' | ||
}; | ||
} | ||
import houdini from './lib/graphql/houdiniClient'; | ||
import type { Handle } from '@sveltejs/kit'; | ||
|
||
export const handle: Handle = async ({ event, resolve }) => { | ||
// set the session information for this event | ||
houdini.setSession(event, { user: { token: '1234-Houdini-Token-5678' } }); | ||
|
||
// pass the event onto the default handle | ||
return await resolve(event); | ||
}; |
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
import { test } from '@playwright/test'; | ||
import { routes } from '../../../../lib/utils/routes.js'; | ||
import { expectToBe, goto } from '../../../../lib/utils/testsHelper.js'; | ||
import { clientSideNavigation, expectToBe, goto } from '../../../../lib/utils/testsHelper.js'; | ||
|
||
test.describe('query preprocessor', () => { | ||
test('onError hook', async ({ page }) => { | ||
await goto(page, routes.Plugin_query_onError); | ||
|
||
await expectToBe(page, 'hello'); | ||
}); | ||
|
||
test('onError hook blocks on client', async ({ page }) => { | ||
await goto(page, routes.Home); | ||
await clientSideNavigation(page, routes.Plugin_query_onError); | ||
|
||
await expectToBe(page, 'hello'); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ | |
</script> | ||
|
||
<div id="result"> | ||
{JSON.stringify({ data })} | ||
{data.hello} | ||
</div> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<script lang="ts"> | ||
import { graphql } from '$houdini'; | ||
const Session = graphql` | ||
query Session { | ||
session | ||
} | ||
`; | ||
</script> | ||
|
||
<h1>SSR Session</h1> | ||
|
||
<div id="result"> | ||
{$Session.data?.session} | ||
</div> |
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,13 @@ | ||
import { test } from '@playwright/test'; | ||
import { routes } from '../../../lib/utils/routes.js'; | ||
import { expectToBe, expect_0_gql } from '../../../lib/utils/testsHelper.js'; | ||
|
||
test.describe('SSR Session Page', () => { | ||
test('No GraphQL request & Should display the session token', async ({ page }) => { | ||
await page.goto(routes.Stores_Session); | ||
|
||
await expect_0_gql(page); | ||
|
||
await expectToBe(page, '1234-Houdini-Token-5678'); | ||
}); | ||
}); |
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
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
Oops, something went wrong.