Skip to content

feat(CommandMenu): add component #720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

feat(CommandMenu): add component #720

wants to merge 8 commits into from

Conversation

tenphi
Copy link
Member

@tenphi tenphi commented Jul 11, 2025

No description provided.

Copy link

changeset-bot bot commented Jul 11, 2025

🦋 Changeset detected

Latest commit: aca5a85

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

This PR includes changesets to release 1 package
Name Type
@cube-dev/ui-kit Minor

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

Copy link

vercel bot commented Jul 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cube-ui-kit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 3:49pm
cube-ui-kit-cursor ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 3:49pm

Copy link
Contributor

github-actions bot commented Jul 11, 2025

📦 NPM canary release

Deployed canary version 0.0.0-canary-70fb30b.

Copy link
Contributor

github-actions bot commented Jul 11, 2025

🧪 Storybook is successfully deployed!

Copy link
Contributor

github-actions bot commented Jul 11, 2025

🏋️ Size limit report

Name Size Passed?
All 261.17 KB (+0.86% 🔺) No 👎
Tree shaking (just a Button) 21.71 KB (0% 🟰) Yes 🎉
Tree shaking (just an Icon) 11.4 KB (0% 🟰) Yes 🎉

Click here if you want to find out what is changed in this build

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Tree State Initialization Timing Issue

The handleSelectionChange function attempts to access treeState.collection.getKeys() before treeState is defined. This causes a ReferenceError at runtime when the 'all' selection case is triggered, as handleSelectionChange is used in mergeProps before treeState is initialized.

src/components/actions/CommandMenu/CommandMenu.tsx#L120-L136

const handleSelectionChange = onSelectionChange
? (keys: any) => {
if (keys === 'all') {
// Handle 'all' selection case - collect all available keys
const allKeys = Array.from(treeState.collection.getKeys()).map(
(key: any) => String(key),
);
onSelectionChange(allKeys);
} else if (keys instanceof Set) {
onSelectionChange(Array.from(keys).map((key) => String(key)));
} else {
onSelectionChange([]);
}
}
: undefined;

Fix in CursorFix in Web


Bug: Function Accesses Undefined State Variable

The handleSelectionChange function attempts to access state.collection.getKeys() before the state variable is defined. Since handleSelectionChange is passed to mergeProps prior to state's initialization, this results in a ReferenceError when the selection change handler is invoked, particularly for the 'all' selection case.

src/components/actions/Menu/Menu.tsx#L97-L113

const handleSelectionChange = onSelectionChange
? (keys: any) => {
if (keys === 'all') {
// Handle 'all' selection case - collect all available keys
const allKeys = Array.from(state.collection.getKeys()).map(
(key: any) => String(key),
);
onSelectionChange(allKeys);
} else if (keys instanceof Set) {
onSelectionChange(Array.from(keys).map((key) => String(key)));
} else {
onSelectionChange([]);
}
}
: undefined;

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

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.

1 participant