Skip to content
Source
Sign inSign up
TanStack/router

ServerFunction does not serialize from client-side loader invocation #7437

Openarackaf(GitHub profile, opens in a new tab) opened this issue 3 comments

Which project does this relate to?

Start

Describe the bug

I'm seeing the most boring server function imaginable fail to de-serialize when called from a client-side loader.

Repro below

Complete minimal reproducer

https://github.com/arackaf/my-blog/tree/special/bug-repro

Steps to Reproduce the Bug

Clone npm i npm run dev browse here: http://localhost:3000/blog/swift-codable-any then click the back arrow at the top

Page should error out. But then refresh the page on that root url - it should load

What's crazy is that the serverFn in that root url returns static data. I can't imagine what's making it fail to serialize

.handler(async () => { return [ { markdownContent: "", title: "Swift - Encoding and decoding Any", date: "2022-07-12T10:00:00.000Z", description: "How to encode and decode json with concrete types, which include dynamic pieces typed as Any", slug: "swift-codable-any", }, ];

Expected behavior

Should work :)

Screenshots or Videos

n/a

Platform

  • Router / Start Version: [e.g. 1.121.0] "@tanstack/react-router": "^1.170.4", "@tanstack/react-start": "^1.168.6",
  • OS: [e.g. macOS, Windows, Linux] macOS
  • Browser: [e.g. Chrome, Safari, Firefox] Chrome
  • Browser Version: [e.g. 91.1] 148
  • Bundler: [e.g. vite] Vite
  • Bundler Version: [e.g. 7.0.0] 7.1.7

Additional context

No response

  1. Hey hey, I tried creating a minimal repo to reproduce your issue, while also using the same versions of dependencies, and the same structure, I was not able to reproduce.

    https://github.com/LukasGerm/repro-7437

  2. schiller-manuel(GitHub profile, opens in a new tab) added labelsinformation needed

  3. Thanks for the repo! I’m actually close here. It’s a dependency that’s causing this, that fixes when upgraded

  4. @schiller-manuel pull latest on my repro above, same branch. It's fixed now. The fix was removing this

    "@tanstack/react-devtools": "^0.10.5",

    which wasn't being used anywhere. Revert that commit, browse to here

    http://localhost:3000/

    and click the big link to Swift - Encoding and decoding Any and it should error out

Sign in to join this conversation.