Skip to content

<Link> Element to Static Route Hits Route Loader Dynamically Anyway #3958

Closed as not planned
@mattymattdev

Description

@mattymattdev

Which project does this relate to?

Router

Describe the bug

When you set up a static route with Nitro any Tanstack components to the static route will still attempt to call the loader dynamically.

If you are doing anything in the static route that is only available during the build phase, this will result in an error.

Hitting the link directly in the browser, through an Anchor () ref, or refreshing the page once you've errored out via your will load the page correctly via the Nitro-generated static site.

Treading lightly here as I know Static with Nitro implementation is still a WIP. 😄

Your Example Website or App

mattymattdev/symmetrical-octo-couscous@b3da210

Steps to Reproduce the Bug or Issue

  1. Create a static route as per the docs
  2. Do something in that route that requires something only available as a resource during build time
  3. Link to the static route with a Link component
  4. Build everything and navigate to your site
  5. Click the and watch whatever you're trying to access on the client side fail even though it was supposed to be a static route

Expected behavior

As a user I expected my to work.

Screenshots or Videos

No response

Platform

  • Ubuntu, building for Cloudflare Pages

Additional context

Rationale for bringing this up is that different pages and teams might become static at different times during the optimization lifecycles of a new web app and it would be nice if hunting potentially dynamically generated s wasn't necessary if you wanted to do that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions