Skip to content

fix(parser): lru cache - #753

Merged
tenphi merged 5 commits into
mainfrom
minor-fixes
Aug 11, 2025
Merged

fix(parser): lru cache#753
tenphi merged 5 commits into
mainfrom
minor-fixes

Conversation

@tenphi

@tenphi tenphi commented Aug 11, 2025

Copy link
Copy Markdown
Member

No description provided.

@changeset-bot

changeset-bot Bot commented Aug 11, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d05c157

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 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

@tenphi
tenphi requested a review from Copilot August 11, 2025 09:51
@vercel

vercel Bot commented Aug 11, 2025

Copy link
Copy Markdown

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 Aug 11, 2025 10:41am
cube-ui-kit-cursor ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 11, 2025 10:41am

@github-actions

github-actions Bot commented Aug 11, 2025

Copy link
Copy Markdown
Contributor

📦 NPM canary release

Deployed canary version 0.0.0-canary-fc6f333.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses several bug fixes and improvements across the UI kit, primarily focusing on fixing an LRU cache implementation and making minor corrections to component APIs and documentation.

Key changes:

  • Enhanced LRU cache robustness with null checks and input validation
  • Updated DialogContainer default behavior for dismissability
  • Fixed syntax error in Label component styling

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/tasty/parser/lru.ts Added null safety checks and input validation to prevent cache corruption
src/components/overlays/Dialog/DialogContainer.tsx Set isDismissable default value to true
src/components/form/Label.tsx Fixed CSS variable syntax from @ to $ prefix
src/components/fields/TextInput/TextInput.docs.mdx Removed unused Canvas import and wrapper
src/components/actions/CommandMenu/CommandMenu.stories.tsx Removed explicit isDismissable=false to use new default
.changeset/*.md Added changelog entries for the fixes

Comment thread src/tasty/parser/lru.ts Outdated
constructor(private limit = 1000) {}
constructor(private limit = 1000) {
// Normalize limit to a non-negative integer to avoid edge cases
if (!Number.isFinite(this.limit) || this.limit < 0) this.limit = 0;

Copilot AI Aug 11, 2025

Copy link

Choose a reason for hiding this comment

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

Setting the limit to 0 when invalid input is provided will disable caching entirely. Consider using a default value like 1000 instead to maintain cache functionality.

Suggested change
if (!Number.isFinite(this.limit) || this.limit < 0) this.limit = 0;
if (!Number.isFinite(this.limit) || this.limit < 0) this.limit = 1000;

Copilot uses AI. Check for mistakes.
Comment thread src/tasty/parser/lru.ts
if (prevNode) prevNode.next = null;
}
this.tail = node.prev;
if (this.head === old) this.head = null;

Copilot AI Aug 11, 2025

Copy link

Choose a reason for hiding this comment

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

This line should be executed before line 75 (this.tail = node.prev;). When the cache has only one element, setting this.tail = node.prev will set tail to null, but head should also be set to null in this case. The current order may leave the cache in an inconsistent state.

Suggested change
if (this.head === old) this.head = null;
if (this.head === old) {
this.head = null;
this.tail = null;
} else {
this.tail = node.prev;
}

Copilot uses AI. Check for mistakes.
@github-actions

github-actions Bot commented Aug 11, 2025

Copy link
Copy Markdown
Contributor

🧪 Storybook is successfully deployed!

@github-actions

github-actions Bot commented Aug 11, 2025

Copy link
Copy Markdown
Contributor

🏋️ Size limit report

Name Size Passed?
All 276.43 KB (+0.03% 🔺) Yes 🎉
Tree shaking (just a Button) 23.02 KB (+0.29% 🔺) Yes 🎉
Tree shaking (just an Icon) 12.14 KB (+0.63% 🔺) Yes 🎉

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

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.

2 participants