Skip to content

Commit

Permalink
chore: check createClient returns
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Dec 20, 2024
1 parent c7805aa commit 999ce0b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/sync/write_client_entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ const pathModifier = (path) => {
};
if (client.createClient) {
const { Root, router } = client.createClient();
const created = client.createClient();
if (!created.Root) {
throw new Error('createClient does not return Root in ${relativeClientPath}');
}
const elements = <>
<Root />
${
Expand All @@ -86,7 +89,7 @@ if (client.createClient) {
}
${
config?.router?.devtool !== false
? `<TanStackRouterDevtools router={router} initialIsOpen=${config?.router?.devtool?.options?.initialIsOpen || '{false}'} position=${config?.router?.devtool?.options?.position || '"bottom-left"'} />`
? `{created.router && <TanStackRouterDevtools router={created.router} initialIsOpen=${config?.router?.devtool?.options?.initialIsOpen || '{false}'} position=${config?.router?.devtool?.options?.position || '"bottom-left"'} />}`
: ''
}
</>;
Expand Down

0 comments on commit 999ce0b

Please sign in to comment.