Conversation
|
bugbot run |
|
|
||
| console.log('Registry item generated:', registryItem); | ||
| console.log('You can now use this with: npx shadcn@latest init <your-api-endpoint>'); | ||
| }, [pages]) |
There was a problem hiding this comment.
Async fetch result always null due to closure capture
The tailwindConfiguration variable is declared as a local let initialized to null, and fetchTailwindConfiguration() is called directly in the component body (not in a useEffect). This causes multiple problems: the API call fires on every render, and the useCallback for exportProject captures tailwindConfiguration in its closure while it's still null (before the async call completes). The exported registry item will always have tailwindConfiguration: null regardless of the API response. The fix requires using useState to store the fetched value and useEffect to trigger the fetch, with the state variable included in the useCallback dependency array.
There was a problem hiding this comment.
The call actually goes through and populate the registry-item json by the time we interact with export project feature. , but it is true that it should be included in a useEffect to avoid unnecessary calls on render and store it in a useState.
Amending updates now will push in a few minutes.
| /** | ||
| * Generates import statements for complex components | ||
| */ | ||
| const registryDependencies: Array<string | undefined> = []; |
There was a problem hiding this comment.
Module-level array accumulates data across function calls
The registryDependencies array is declared at module scope and values are pushed to it in generateImports, but it's never cleared between calls to generateRegistryItem. Each export will include dependencies from all previous exports during the session, causing incorrect registry items with duplicated or unrelated dependencies. This array needs to be reset at the start of each generateRegistryItem call or moved to local scope.
Additional Locations (1)
| .get("/api/getTailwindConfig") | ||
| .then((response) => { | ||
| console.log(tailwindConfiguration, "tailwindConfig"); | ||
| tailwindConfiguration = response.data.data.plugins[0]; |
There was a problem hiding this comment.
Extracts plugin instead of full tailwind configuration
The code assigns response.data.data.plugins[0] to tailwindConfiguration, which extracts the first Tailwind plugin (a function like tailwindcss-animate) rather than the actual configuration object. The Tailwind interface expects a Config object with properties like content, theme, prefix, and extend, but a plugin function doesn't match this structure. The exported registry item will contain incorrect/unusable tailwind configuration data.
lib/registry-utils.ts
Outdated
| tailwind: tailwindConfiguration, | ||
| registryDependencies: registryDependencies | ||
| ? registryDependencies | ||
| : ["card"], |
There was a problem hiding this comment.
Empty array fallback never triggers due to truthiness
The ternary registryDependencies ? registryDependencies : ["card"] will never fall back to ["card"] because registryDependencies is an array, and empty arrays are truthy in JavaScript. If the intent was to provide a default when no dependencies were collected, the condition needs to check registryDependencies.length > 0 instead.
|
Hey @Arsanyos! Thanks for the contribution 🙌 Before diving into the feedback, I want to make sure I understand the purpose of this feature correctly: My understanding: This change allows users who have built pages with ui-builder to export them as a shadcn registry item ( Architectural ConcernsBesides the bugbot suggestions and the CI linting check issues, I have some concerns about this approach: 1. API Route DependencySince ui-builder is distributed as a shadcn component, when someone runs
It does NOT install:
What happens when someone installs ui-builder via
Additionally, even if the API route existed, 2. Custom Components Can't Be Exportedui-builder's component registry Let me know if I've misunderstood the purpose of this feature! Happy to discuss further. |
|
Thank you for your time and giving this a look 🙌 Yes you are right , it is meant to export JSON that is compliant with shadcn registry structure and allow to scaffold a project from it. I am giving your other comments a look now , will provide response in a bit |
|
@olliethedev Thanks for the thoughtful review! I think there's a misunderstanding about the architecture: Comments on the First review ( API Route Dependency ) What am thinking is like this
The API routes never leave the builder app. The exported JSON contains serialized component data, not API routes or server infrastructure. Hope this offer clarification on what I'm trying to build. |
|
@olliethedev if am getting you right
the top three components are made purely using **** and ****
---
If i am missing what you are trying to convey , i'm here to be corrected.
|
|
Hey @Arsanyos, I appreciate the effort here, but I think there's still a core misunderstanding about the architecture. There is no "builder app", ui-builder is a React component that users install into their own projects: # User runs this in THEIR project
npx shadcn@latest add https://raw.githubusercontent.com/olliethedev/ui-builder/main/registry/block-registry.json
# This installs the component files into THEIR project:
# - components/ui/ui-builder/
# - lib/ui-builder/
# - hooks/After installation, users import and render Why the current approach doesn't work:
If you want to pursue this feature, it would need to:
The existing "Copy Code" feature already converts layers to React components client-side, this would be an extension of that pattern. Happy to help brainstorm if you want to take a different approach! |

Changes Made
Blocker i am facing is that configuring the export for the specific framework to render the export on the entry point of that specific framework ,
I initially did it for Next , but going around doing it for the others ( vite, Next(mono) ) seemed manual , Insights on this will be awesome.
Thank you.
Note
Implements framework-agnostic export of UI Builder pages as a shadcn registry item and wires Tailwind config into the flow.
GET /api/getTailwindConfigto serve the Tailwind configtailwind.config.jsto ESM (export default config) to enable server importlib/registry-utils.tsto collect component deps, generate React component files, and assemble a registry item (deps/devDeps/files/tailwind)ExportProjectFeatureto the nav bar to fetch Tailwind config and download aregistry-item.jsonTailwindtyping and minor util cleanup; addsaxiosand pinsnextto 15.3.8 (lockfile updated)Written by Cursor Bugbot for commit e7a4a30. This will update automatically on new commits. Configure here.