Skip to content

Commit

Permalink
fix single flight in ssr false
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansolid committed May 21, 2024
1 parent e60e0b6 commit 0499779
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/dry-shrimps-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@solidjs/start": patch
---

fix single flight in ssr false
12 changes: 8 additions & 4 deletions packages/start/config/fs-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class SolidStartClientFileRouter extends BaseFileSystemRouter {

if (src.endsWith(".md") || src.endsWith(".mdx")) {
return {
page: true,
$component: {
src: src,
pick: ["$css"]
Expand All @@ -35,10 +36,11 @@ export class SolidStartClientFileRouter extends BaseFileSystemRouter {
}

const [_, exports] = analyzeModule(src);
const hasDefault = exports.find(e => e.n === "default");
const hasRouteConfig = exports.find(e => e.n === "route");
const hasDefault = !!exports.find(e => e.n === "default");
const hasRouteConfig = !!exports.find(e => e.n === "route");
if (hasDefault) {
return {
page: true,
$component: {
src: src,
pick: ["default", "$css"]
Expand Down Expand Up @@ -93,6 +95,7 @@ export class SolidStartServerFileRouter extends BaseFileSystemRouter {
let path = this.toPath(src);
if (src.endsWith(".md") || src.endsWith(".mdx")) {
return {
page: true,
$component: {
src: src,
pick: ["$css"]
Expand All @@ -105,10 +108,11 @@ export class SolidStartServerFileRouter extends BaseFileSystemRouter {

const [_, exports] = analyzeModule(src);
const hasRouteConfig = exports.find(e => e.n === "route");
const hasDefault = exports.find(e => e.n === "default");
const hasAPIRoutes = exports.find(exp => HTTP_METHODS.includes(exp.n));
const hasDefault = !!exports.find(e => e.n === "default");
const hasAPIRoutes = !!exports.find(exp => HTTP_METHODS.includes(exp.n));
if (hasDefault || hasAPIRoutes) {
return {
page: hasDefault,
$component:
!this.config.dataOnly && hasDefault
? {
Expand Down
2 changes: 1 addition & 1 deletion packages/start/src/router/FileRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function createRoutes() {
...(route.$$route ? route.$$route.require().route.info : {}),
filesystem: true
},
component: lazyRoute(
component: route.$component && lazyRoute(
route.$component,
import.meta.env.START_ISLANDS
? import.meta.env.MANIFEST["ssr"]
Expand Down
3 changes: 2 additions & 1 deletion packages/start/src/router/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ interface Route {
path: string;
id: string;
children?: Route[];
page?: boolean;
$component?: any;
$GET?: any;
$POST?: any;
Expand All @@ -23,7 +24,7 @@ declare module "vinxi/routes" {
}

export const pageRoutes = defineRoutes(
(fileRoutes as unknown as Route[]).filter(o => o.$component)
(fileRoutes as unknown as Route[]).filter(o => o.page)
);

function defineRoutes(fileRoutes: Route[]) {
Expand Down

0 comments on commit 0499779

Please sign in to comment.