router icon indicating copy to clipboard operation
router copied to clipboard

When there's backticks in the loader response. Dev fails.

Open jadedevin13 opened this issue 1 year ago • 0 comments

Describe the bug

This happens because the console.log that has the content "Injected From Server:" does not sanitize the output.

TBH. I'm not even sure if I should be the one to sanitize the inputs before returning it.

Your Example Website or App

N/A

Steps to Reproduce the Bug or Issue

Replace _layout.ts in start basic example with the following codes.

import { Outlet, createFileRoute } from '@tanstack/react-router'

export const Route = createFileRoute('/_layout')({
  loader: async () => {
    return {
      staticData: {
        nice: 'sam`ple`data',
      },
    }
  },
  component: LayoutComponent,
})

function LayoutComponent() {
  const { staticData } = Route.useLoaderData()
  return (
    <div className="p-2">
      {staticData.nice}
      <div>I'm a layout</div>
      <div>
        <Outlet />
      </div>
    </div>
  )
}
image

Expected behavior

Should clean/sanitize the console.log output?

Screenshots or Videos

No response

Platform

"@tanstack/react-router": "^1.45.6",
"@tanstack/router-devtools": "^1.45.6",
"@tanstack/router-plugin": "^1.45.3",
"@tanstack/start": "^1.45.6",
"@typescript-eslint/parser": "^7.16.0",
"@vitejs/plugin-react": "^4.3.1",
"isbot": "^5.1.12",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"redaxios": "^0.5.1",
"tailwind-merge": "^2.4.0",
"vinxi": "0.3.12"

Additional context

No response

jadedevin13 avatar Jul 19 '24 20:07 jadedevin13