-
Notifications
You must be signed in to change notification settings - Fork 492
Frontend code for custom number nodes #7768
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
Conversation
📝 WalkthroughWalkthroughRefactored the custom widget extension by splitting a single Changes
Possibly related PRs
Suggested reviewers
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎨 Storybook Build Status✅ Build completed successfully! ⏰ Completed at: 01/25/2026, 12:09:22 AM UTC 🔗 Links🎉 Your Storybook is ready for review! |
🎭 Playwright Tests:
|
Bundle Size ReportSummary
Category Glance Per-category breakdownApp Entry Points — 22.8 kB (baseline 22.8 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 957 kB (baseline 957 kB) • ⚪ 0 BGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed Views & Navigation — 80.7 kB (baseline 80.7 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 9 added / 9 removed Panels & Settings — 462 kB (baseline 462 kB) • 🟢 -8 BConfiguration panels, inspectors, and settings screens
Status: 12 added / 12 removed User & Accounts — 3.94 kB (baseline 3.94 kB) • ⚪ 0 BAuthentication, profile, and account management bundles
Status: 3 added / 3 removed Editors & Dialogs — 2.83 kB (baseline 2.83 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 2 added / 2 removed UI Components — 33.7 kB (baseline 33.7 kB) • ⚪ 0 BReusable component library chunks
Status: 5 added / 5 removed Data & Services — 3.18 MB (baseline 3.18 MB) • 🔴 +1 BStores, services, APIs, and repositories
Status: 8 added / 8 removed Utilities & Hooks — 25.2 kB (baseline 25.2 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 7 added / 7 removed Vendor & Third-Party — 10.7 MB (baseline 10.7 MB) • ⚪ 0 BExternal libraries and shared vendor chunks
Other — 6.43 MB (baseline 6.43 MB) • 🔴 +2.1 kBBundles that do not match a named category
Status: 34 added / 34 removed |
2a4e84f to
e78786f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/extensions/core/customCombo.ts (1)
56-68: Prefer a function declaration forupdateCombo.This helper is pure and can be declared with
function updateCombo()for consistency with repo conventions.🔧 Proposed refactor
- const updateCombo = () => { + function updateCombo() { values.splice( 0, values.length, ...this.widgets!.filter( (w) => w.name.startsWith('option') && w.value ).map((w) => `${w.value}`) ) if (app.configuringGraph) return if (values.includes(`${comboWidget.value}`)) return comboWidget.value = values[0] ?? '' comboWidget.callback?.(comboWidget.value) - } + }Based on learnings, prefer function declarations for pure helpers.
🤖 Fix all issues with AI agents
In `@src/extensions/core/customCombo.ts`:
- Around line 108-119: The getters for valueWidget.options 'min' and 'max' use
unsafe 64-bit literals (-(2 ** 63) and 2 ** 63) which exceed JavaScript's safe
integer range; update the defaults to safe integer limits (use
Number.MIN_SAFE_INTEGER and Number.MAX_SAFE_INTEGER or equivalent -(2**53-1) and
2**53-1) so this.properties.min ?? <safe-min> and this.properties.max ??
<safe-max> return accurate bounds; keep the existing setters
(this.properties.min/max assignment and
valueWidget.callback?.(valueWidget.value)) unchanged.
- Around line 155-163: In onCustomFloatCreated, fix step2 on valueWidget.options
so the default uses the correct precision formula (use 10 ** -precision, not 10
** precision), allow explicit zero by checking this.properties.step != null
instead of truthiness, and update the setter (step2) to both assign
this.properties.step = v and invoke the same reactivity callback pattern used in
onCustomIntCreated (i.e., call the callback after assignment) so UI updates
correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/extensions/core/customCombo.ts`:
- Around line 164-172: The setter for Object.defineProperty on
valueWidget.options 'round' incorrectly writes to this.properties.step and
doesn't trigger reactive updates; change the setter to assign the new value to
this.properties.round and ensure reactivity by reassigning the properties object
(e.g., this.properties = { ...this.properties, round: v }) or call the
component's existing property-update helper if present so the change propagates;
keep the getter as-is and only modify the set: from (v) => (this.properties.step
= v) to set round on this.properties and trigger update.
♻️ Duplicate comments (2)
src/extensions/core/customCombo.ts (2)
108-119: Use safe integer bounds for default min/max.
±(2 ** 63)exceeds JS safe integer range and can introduce precision loss in widget bounds.🔧 Proposed fix
Object.defineProperty(valueWidget.options, 'min', { - get: () => this.properties.min ?? -(2 ** 63), + get: () => this.properties.min ?? Number.MIN_SAFE_INTEGER, set: (v) => { this.properties.min = v valueWidget.callback?.(valueWidget.value) } }) Object.defineProperty(valueWidget.options, 'max', { - get: () => this.properties.max ?? 2 ** 63, + get: () => this.properties.max ?? Number.MAX_SAFE_INTEGER, set: (v) => { this.properties.max = v valueWidget.callback?.(valueWidget.value) } })
155-163: Fixstep2reactivity and allow explicit zero.The truthy check drops
0, and the setter doesn’t trigger the callback, so updates won’t propagate.🔧 Proposed fix
Object.defineProperty(valueWidget.options, 'step2', { get: () => { - if (this.properties.step) return this.properties.step + if (this.properties.step != null) return this.properties.step const { precision } = this.properties return typeof precision === 'number' ? 5 * 10 ** -precision : 1 }, - set: (v) => (this.properties.step = v) + set: (v) => { + this.properties.step = v + valueWidget.callback?.(valueWidget.value) + } })
Current types (overwriting core primivites) is placeholder Code is more verbose than I'd like, but probably not worth fixing
139ac45 to
b278b5a
Compare

Allows creation of Int and Float widgets with configurable, min, max, step, and precision.
This PR has been fairly heavily reworked. Options are no longer exposed as widgets, but set as properties on the node.
Since the changes no longer modify the sizing or serialization of the node, backend changes are no longer required and the extended functionality has been added directly onto the existing PrimitiveFloat and PrimitiveInt nodes.
There's intent to expose these configuration parameters on the new properties panel, but this PR can be merged as is.
┆Issue is synchronized with this Notion page by Unito