solidjs / solidjs/solid-start

[Feature?]: Add an option to disable lazy loading in `<FileRoutes />`

Open
#1,575 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement file routes
Dominant language
TypeScript
Stars
5.9k
Forks
426
Avg merge
1d 3h
Merged PRs (30d)
11

Description

Duplicates
  • I have searched the existing issues
Latest version
  • I have tested the latest version
Summary 💡

currently, FileRoutes lazy-loades all routes by default which is sometimes undesired.

Adding a sync option (that is false by default) or a async option to enable lazy loading (that is false by default) to FileRoutes to disable lazy loading all routes will fix that.

even better, this could be decided for each route separately.

Examples 🌈

a workaround is using custom <Route />s instead of using <FileRoutes />:

import { MetaProvider, Title } from "@solidjs/meta";
import { Route, Router } from "@solidjs/router";
import { Suspense } from "solid-js";
import Home from "./routes";
import About from "./routes/about";
import { get } from "./lib/api";
import NotFound from "./routes/[...404]";

export default function App() {
  return (
    <Router
      root={(props) => (
        <MetaProvider>
          <Title>SolidStart - Basic</Title>
          <a href="/">Index</a>
          <a href="/about">About</a>
          <Suspense>{props.children}</Suspense>
        </MetaProvider>
      )}
    >
      <Route path="/" component={Home} />
      <Route load={() => get()} path="/about" component={About} />
      <Route path="*404" component={NotFound} />
    </Router>
  );
}
Motivation 🔦

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the FileRoutes entry point and compare its behavior with the custom Route examples shown in the issue. Clarify whether the API should disable lazy loading globally or per route, then verify that the selected option causes routes to load synchronously while preserving the default lazy behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.