Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/big-corners-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@baseplate-dev/react-generators': patch
---

Add a default pending component to router
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
import type { ErrorRouteComponent } from '@tanstack/react-router';

import { routeTree } from '$routeTree';
import { Button, ErrorDisplay, NotFoundCard } from '%reactComponentsImports';
import {
Button,
ErrorDisplay,
Loader,
NotFoundCard,
} from '%reactComponentsImports';
Comment on lines +6 to +11
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Importing Loader is correct; verify it’s exposed by the import provider.

Looks good. Ensure %reactComponentsImports maps/exports Loader; otherwise the generated import will fail at build-time.


🏁 Script executed:

#!/bin/bash
# Locate the generated imports provider(s) and verify Loader is present
fd -a 'ts-import-providers.ts' | while read -r f; do
  echo "== $f =="
  rg -n -C2 '\bLoader\b' "$f" || true
done

Length of output: 434


Loader isn’t exposed by %reactComponentsImports
The extractor at packages/core-generators/src/renderers/typescript/extractor/render-ts-import-providers.ts never registers Loader, so the generated template will fail to import it. Please update the %reactComponentsImports mapping to include Loader, for example:

  "%reactComponentsImports": [
    "import { Button } from '@your-ui-lib';",
    "import { ErrorDisplay } from '@your-ui-lib';",
+   "import { Loader } from '@your-ui-lib';",
    "import { NotFoundCard } from '@your-ui-lib';",
  ],

This will ensure the Loader import in packages/react-generators/src/generators/core/react-router/templates/src/app/router.tsx resolves correctly.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import {
Button,
ErrorDisplay,
Loader,
NotFoundCard,
} from '%reactComponentsImports';
"%reactComponentsImports": [
"import { Button } from '@your-ui-lib';",
"import { ErrorDisplay } from '@your-ui-lib';",
"import { Loader } from '@your-ui-lib';",
"import { NotFoundCard } from '@your-ui-lib';",
],
🤖 Prompt for AI Agents
In
packages/react-generators/src/generators/core/react-router/templates/src/app/router.tsx
around lines 6–11, the template imports Loader from the placeholder
%reactComponentsImports but the extractor at
packages/core-generators/src/renderers/typescript/extractor/render-ts-import-providers.ts
never registers Loader; update that mapping to include Loader (add it to the
%reactComponentsImports provider registration/export list so the placeholder
expands to an import for Loader), then regenerate or re-run the generator to
ensure the template import resolves correctly.

import { createRouter } from '@tanstack/react-router';

function ErrorComponent({
Expand All @@ -26,6 +31,7 @@ export const router = createRouter({
routeTree,
defaultNotFoundComponent: NotFoundCard,
defaultErrorComponent: ErrorComponent,
defaultPendingComponent: Loader,
TPL_ADDITIONAL_ROUTER_OPTIONS,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"fileOptions": { "kind": "singleton" },
"pathRootRelativePath": "{routes-root}/-components/password-reset-dialog.gql",
"sourceFile": "routes/-components/password-reset-dialog.gql",
"variables": {}
"variables": { "TPL_USER_ROW_FRAGMENT": {} }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const passwordResetDialogGql = createTextTemplateFile({
'../templates/routes/-components/password-reset-dialog.gql',
),
},
variables: {},
variables: { TPL_USER_ROW_FRAGMENT: {} },
});

export const LOCAL_AUTH_ADMIN_ADMIN_CRUD_RESET_PASSWORD_ACTION_TEMPLATES = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
mutation ResetUserPassword($input: ResetUserPasswordInput!) {
resetUserPassword(input: $input) {
user {
id
name
email
...TPL_USER_ROW_FRAGMENT
}
}
}
Loading