-
Notifications
You must be signed in to change notification settings - Fork 1
Remote function #359
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
Remote function #359
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the codebase to use SvelteKit's new remote functions and top-level await features, replacing the traditional server-side data loading approach with a more streamlined component-based data fetching pattern.
- Enables experimental async support and remote functions in SvelteKit configuration
- Converts server-side tweet fetching to a remote function with client-side component loading
- Upgrades SvelteKit and Svelte to versions that support these new features
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
svelte.config.js | Enables experimental async and remote functions features |
src/routes/ListenersTweets.svelte | Refactors to use individual Tweet components instead of server-provided data |
src/routes/+page.svelte | Removes dependency on server-side data loading |
src/routes/+page.server.ts | Removes server-side data loading logic (deleted) |
src/lib/Tweet/index.ts | Exports new Tweet component |
src/lib/Tweet/getTweet.remote.ts | Implements remote function for tweet fetching with validation |
src/lib/Tweet/Tweet.svelte | Creates component that uses remote function with top-level await |
package.json | Updates SvelteKit, Svelte versions and adds valibot dependency |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Deploying vim-jp-radio-lp with
|
Latest commit: |
c4933da
|
Status: | ✅ Deploy successful! |
Preview URL: | https://6da997fc.lp-d1f.pages.dev |
Branch Preview URL: | https://remote.lp-d1f.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/lib/Tweet/Tweet.svelte
Outdated
const { id }: Props = $props(); | ||
</script> | ||
|
||
<svelte:boundary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://svelte.dev/docs/svelte/await-expressions#Boundaries
boundaryで囲ってあげる必要がある
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boundaryを使う方法はprerenderだと動かないっぽい
Svelte does not yet support asynchronous server-side rendering, and as such it’s likely that you’re only calling remote functions from the browser, rather than during prerendering. Because of this you will need to use inputs, for now. We’re actively working on this roadblock.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
なのでやめた
あれ、リスナーの声が表示されてない |
だめじゃんあれ |
…hronous server-side rendering
直った!マージします |
結局top-level-awaitは使わなかった |
sveltekitのremote functionとtop-level-awaitが生えたので反映
めっちゃみやすくなったと思う
https://svelte.dev/docs/kit/remote-functions
https://svelte.dev/docs/svelte/await-expressions