Skip to content

Commit

Permalink
fix: dummy component should return null
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanCassiere committed Sep 19, 2024
1 parent f85171d commit ebe9476
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 21 deletions.
8 changes: 1 addition & 7 deletions packages/router-plugin/src/core/code-splitter/compilers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ export function compileCodeSplitReferenceRoute(opts: ParseAstOptions) {
path.parentPath.node.arguments[0],
)

let found = false

const hasImportedOrDefinedIdentifier = (name: string) => {
return programPath.scope.hasBinding(name)
}
Expand Down Expand Up @@ -151,8 +149,6 @@ export function compileCodeSplitReferenceRoute(opts: ParseAstOptions) {
`lazyRouteComponent($$splitComponentImporter, 'component')`,
)()
}

found = true
} else if (prop.key.name === 'loader') {
const value = prop.value

Expand Down Expand Up @@ -201,8 +197,6 @@ export function compileCodeSplitReferenceRoute(opts: ParseAstOptions) {
prop.value = template.expression(
`lazyFn($$splitLoaderImporter, 'loader')`,
)()

found = true
}
}
}
Expand All @@ -216,7 +210,7 @@ export function compileCodeSplitReferenceRoute(opts: ParseAstOptions) {
// }
programPath.pushContainer('body', [
template.statement(
`export function TSR_Dummy_Component() {}`,
`export function TSR_Dummy_Component() { return null }`,
)(),
])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
loader: lazyFn($$splitLoaderImporter, 'loader')
});
export function TSR_Dummy_Component() {}
export function TSR_Dummy_Component() {
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ export const Route = createFileRoute('/posts')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
component: lazyRouteComponent($$splitComponentImporter, 'component')
});
export function TSR_Dummy_Component() {}
export function TSR_Dummy_Component() {
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
loader: lazyFn($$splitLoaderImporter, 'loader')
});
export function TSR_Dummy_Component() {}
export function TSR_Dummy_Component() {
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import { createFileRoute } from '@tanstack/react-router';
export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component')
});
export function TSR_Dummy_Component() {}
export function TSR_Dummy_Component() {
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
loader: lazyFn($$splitLoaderImporter, 'loader')
});
export function TSR_Dummy_Component() {}
export function TSR_Dummy_Component() {
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ export const Route = createFileRoute('/')({
});
Route.addChildren([]);
export const test = 'test';
export function TSR_Dummy_Component() {}
export function TSR_Dummy_Component() {
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ export const Route = createFileRoute('/')({
loader: lazyFn($$splitLoaderImporter, 'loader'),
component: lazyRouteComponent($$splitComponentImporter, 'component')
});
export function TSR_Dummy_Component() {}
export function TSR_Dummy_Component() {
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
loader: lazyFn($$splitLoaderImporter, 'loader')
});
export function TSR_Dummy_Component() {}
export function TSR_Dummy_Component() {
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ export const Route = createFileRoute('/')({
component: lazyRouteComponent($$splitComponentImporter, 'component'),
loader: lazyFn($$splitLoaderImporter, 'loader')
});
export function TSR_Dummy_Component() {}
export function TSR_Dummy_Component() {
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ export const Route = createFileRoute('/_layout')({
});
const HEADER_HEIGHT = '63px';
export const SIDEBAR_WIDTH = '150px';
export function TSR_Dummy_Component() {}
export function TSR_Dummy_Component() {
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ const HEADER_HEIGHT = '63px';
export const SIDEBAR_WIDTH = '150px';
export const SIDEBAR_MINI_WIDTH = '80px';
export default Layout;
export function TSR_Dummy_Component() {}
export function TSR_Dummy_Component() {
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ const HEADER_HEIGHT = '63px';
export const SIDEBAR_WIDTH = '150px';
export const SIDEBAR_MINI_WIDTH = '80px';
export default Layout;
export function TSR_Dummy_Component() {}
export function TSR_Dummy_Component() {
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ export const Route = createFileRoute('/_layout')({
});
export const SIDEBAR_WIDTH = '150px';
export const SIDEBAR_MINI_WIDTH = '80px';
export function TSR_Dummy_Component() {}
export function TSR_Dummy_Component() {
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ export const Route = createFileRoute('/_libraries/start/$version/')({
description: startProject.description
})
});
export function TSR_Dummy_Component() {}
export function TSR_Dummy_Component() {
return null;
}

0 comments on commit ebe9476

Please sign in to comment.