TanStack / router

🤖 Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering.

Home Page:https://tanstack.com/router

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Experimental splitting: Wrapping component in `React.memo()` causes `unexpected splitNode` error

mirague opened this issue · comments

Describe the bug

Wrapping the component: in React.memo() causes the following error:

[plugin:router-code-splitter-plugin] /home/projects/tanstack-router-5quplm/src/routes/posts.tsx?tsr-split: 
Unexpected splitNode type ☝️: CallExpression

This does not work:

export const Route = createFileRoute('/posts')({
  component: React.memo(PostsComponent),
});

function PostsComponent() {
  return null
}

Omitting the React.memo() call does not result in an error:

export const Route = createFileRoute('/posts')({
  component: PostsComponent,
});

function PostsComponent() {
  return null
}

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-5quplm?file=src%2Froutes%2Fposts.tsx

Steps to Reproduce the Bug or Issue

  1. Click on Posts (or just hover over it)
  2. Crashes (see screenshot below)

Expected behavior

As a user I expected the code would not crash.

Screenshots or Videos

CleanShot 2024-06-21 at 00 27 51@2x

Platform

  • OS: macOS, Arc 1.47

Additional context

No response