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

feat(start): move scripts,links, and meta to the head #2571

Merged
merged 14 commits into from
Nov 17, 2024

Conversation

SeanCassiere
Copy link
Member

@SeanCassiere SeanCassiere commented Oct 18, 2024

Closes #2426

As discussed in #2426, this change adds a new method named head onto Route. This function takes in the same parameters as meta and returns the values used for scripts, links, and meta. Additionally, the loaderData argument is made to be possibly undefined as this execution may happen both before and after the loader has resolved.

The meta, links, and scripts methods on Route as being dropped and replaced by this new head method.

this change only changes the interface presented to the dev (AnyRoute). the actual interface for a match (AnyRouteMatch) remains the same
Copy link

nx-cloud bot commented Oct 18, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit cca0d77. 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 Oct 18, 2024

Open in Stackblitz

More templates

@tanstack/create-router

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

@tanstack/arktype-adapter

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

@tanstack/history

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

@tanstack/eslint-plugin-router

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

@tanstack/react-cross-context

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

@tanstack/react-router-with-query

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

@tanstack/react-router

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

@tanstack/router-cli

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

@tanstack/router-devtools

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-vite-plugin

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

@tanstack/start

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

@tanstack/start-vite-plugin

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/zod-adapter

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

commit: cca0d77

@SeanCassiere SeanCassiere marked this pull request as ready for review November 17, 2024 21:56
@tannerlinsley tannerlinsley merged commit 4ae6ca9 into main Nov 17, 2024
5 checks passed
@tannerlinsley tannerlinsley deleted the start-head-api branch November 17, 2024 22:19
timoconnellaus pushed a commit to timoconnellaus/tanstack-router that referenced this pull request Dec 4, 2024
…ck#2571)

This minor is non-breaking for Router users, since it's undocumented to the public API, but **is breaking** for Start alpha users. 

This changes the options signature for meta from this:
```tsx
createRoute({
  meta: () => [
    ...
  ],
  links: () => [
    ...
  ],
})
```

to this:

```tsx
createRoute({
  head: () => ({
    meta: [
      ...
    ],
    links: [
      ...
    ],
  })
})
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants