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

fix(start): resolve server functions using a POST JSON request #2766

Merged

Conversation

SeanCassiere
Copy link
Member

@SeanCassiere SeanCassiere commented Nov 15, 2024

  • Fixes a bug where the payload from the fetcher for POST requests weren't being sent over-the-wire using the correct expected shape on the server.
  • Adds tests to close long-standing issues where the invocation of a server function within an already running server function execution caused the returned payloads to not match.

The payload for POST requests changes to look like this.

- const body = defaultTransformer.stringify(first.data ?? null)
+ const body = defaultTransformer.stringify({ data: first.data ?? null, context: first.context  })

Copy link

nx-cloud bot commented Nov 15, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 5165e34. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.

Copy link

pkg-pr-new bot commented Nov 15, 2024

Open in Stackblitz

More templates

@tanstack/arktype-adapter

pnpm add https://pkg.pr.new/@tanstack/arktype-adapter@2766

@tanstack/create-router

pnpm add https://pkg.pr.new/@tanstack/create-router@2766

@tanstack/history

pnpm add https://pkg.pr.new/@tanstack/history@2766

@tanstack/react-cross-context

pnpm add https://pkg.pr.new/@tanstack/react-cross-context@2766

@tanstack/eslint-plugin-router

pnpm add https://pkg.pr.new/@tanstack/eslint-plugin-router@2766

@tanstack/react-router

pnpm add https://pkg.pr.new/@tanstack/react-router@2766

@tanstack/react-router-with-query

pnpm add https://pkg.pr.new/@tanstack/react-router-with-query@2766

@tanstack/router-cli

pnpm add https://pkg.pr.new/@tanstack/router-cli@2766

@tanstack/router-devtools

pnpm add https://pkg.pr.new/@tanstack/router-devtools@2766

@tanstack/router-generator

pnpm add https://pkg.pr.new/@tanstack/router-generator@2766

@tanstack/router-plugin

pnpm add https://pkg.pr.new/@tanstack/router-plugin@2766

@tanstack/router-vite-plugin

pnpm add https://pkg.pr.new/@tanstack/router-vite-plugin@2766

@tanstack/start

pnpm add https://pkg.pr.new/@tanstack/start@2766

@tanstack/start-vite-plugin

pnpm add https://pkg.pr.new/@tanstack/start-vite-plugin@2766

@tanstack/valibot-adapter

pnpm add https://pkg.pr.new/@tanstack/valibot-adapter@2766

@tanstack/virtual-file-routes

pnpm add https://pkg.pr.new/@tanstack/virtual-file-routes@2766

@tanstack/zod-adapter

pnpm add https://pkg.pr.new/@tanstack/zod-adapter@2766

commit: 5165e34

@SeanCassiere SeanCassiere changed the title test(start): check for consistent createServerFn responses fix(start): resolve server functions using a POST JSON request Nov 15, 2024
@SeanCassiere SeanCassiere marked this pull request as ready for review November 15, 2024 08:46
@tannerlinsley tannerlinsley merged commit de69637 into main Nov 15, 2024
5 checks passed
@tannerlinsley tannerlinsley deleted the test/resolved-server-fns-between-server-and-client branch November 15, 2024 15:03
timoconnellaus pushed a commit to timoconnellaus/tanstack-router that referenced this pull request Dec 4, 2024
…ack#2766)

* test(start): check for consistent createServerFn responses between client and server

* chore(start): react-dom nesting rules

* fix(start): resolve payloads for POST requests

* fix(start): enforce default method as `'GET'`
timoconnellaus pushed a commit to timoconnellaus/tanstack-router that referenced this pull request Dec 19, 2024
…ack#2766)

* test(start): check for consistent createServerFn responses between client and server

* chore(start): react-dom nesting rules

* fix(start): resolve payloads for POST requests

* fix(start): enforce default method as `'GET'`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants