Skip to content

Conversation

@dticed
Copy link

@dticed dticed commented Nov 24, 2025

This PR fixes a circular SSR import issue that caused the error:

Error when evaluating SSR "path/to/file" Cannot read properties of undefined (reading 'Root')

The error occurred when internal components imported IsUsingKeyboard from the library’s barrel file ($lib/index.js).
The barrel re-exports all components, creating a circular dependency during SSR evaluation. Switching to a direct import resolves the issue.

@changeset-bot
Copy link

changeset-bot bot commented Nov 24, 2025

🦋 Changeset detected

Latest commit: 3291db5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
bits-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Nov 24, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
bits-ui ✅ Ready (View Log) Visit Preview 3291db5

@ap0nia
Copy link

ap0nia commented Nov 25, 2025

I'm not sure what might be the root cause, but I encounter this issue with versions beyond 2.11.6. The issue subsides when I revert these lines,e.g. by declaring the constants directly in the file instead of importing them.

https://github.com/huntabyte/bits-ui/pull/1831/files#diff-6b9234876183b2862fab54cd5178f9cc60ac6111acdb883c8c3b53db57e635ebR19-R22

@dticed
Copy link
Author

dticed commented Nov 26, 2025

I'm not sure what might be the root cause, but I encounter this issue with versions beyond 2.11.6. The issue subsides when I revert these lines,e.g. by declaring the constants directly in the file instead of importing them.

https://github.com/huntabyte/bits-ui/pull/1831/files#diff-6b9234876183b2862fab54cd5178f9cc60ac6111acdb883c8c3b53db57e635ebR19-R22

This may be related to the menu.svelte.js import. When you import these constants, the entire module is loaded, which I suspect is the source of the issue.

@huntabyte
Copy link
Owner

We could move those outside somewhere as well if needed @ap0nia

@ap0nia
Copy link

ap0nia commented Nov 26, 2025

I'm not sure what might be the root cause, but I encounter this issue with versions beyond 2.11.6. The issue subsides when I revert these lines,e.g. by declaring the constants directly in the file instead of importing them.
https://github.com/huntabyte/bits-ui/pull/1831/files#diff-6b9234876183b2862fab54cd5178f9cc60ac6111acdb883c8c3b53db57e635ebR19-R22

This may be related to the menu.svelte.js import. When you import these constants, the entire module is loaded, which I suspect is the source of the issue.

Yes. I was indicating that the root cause of the circular dependency is unclear. Which module is being circularly imported? This pull request assumes that this line causes it.

import { IsUsingKeyboard } from "$lib/index.js";

However, this was in the library in version 2.11.6, which I noted to work fine in my particular project.

The pull request fixes a line of code that might be a red herring for the actual root cause of the circular dependency, given that the library worked fine for me with original line of code. It may also be possible that both of these lines, as well as additional ones, are collectively causing issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants