Skip to content

fix: block neighbor expansion while the limit input is empty - #2069

Open
vishwakt wants to merge 1 commit into
aws:mainfrom
vishwakt:issue-2068-expand-limit-empty-input
Open

fix: block neighbor expansion while the limit input is empty#2069
vishwakt wants to merge 1 commit into
aws:mainfrom
vishwakt:issue-2068-expand-limit-empty-input

Conversation

@vishwakt

@vishwakt vishwakt commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #2068

Clearing the limit field stored NaN, because parseInt("") returns NaN and ?? only catches null or undefined. The expand request treats a falsy limit as no limit, so the request went out unlimited while the toggle still showed a limit was applied.

The limit state now stores null for an empty or invalid input, the field renders empty instead of value={NaN}, and the Expand button is disabled until a valid limit is entered or the toggle is turned off.

Verified against a local TinkerPop Gremlin Server through the proxy server, with a node seeded with 303 neighbors. With the field cleared, the outgoing Gremlin query on main had no .range() clause. With a valid limit of 10 on this branch, the query contains .range(0, 10) and exactly 10 neighbors arrive. Added a component test covering the cleared and repopulated input.

Before, the setup: limit toggle on, field cleared, Expand still enabled:

before-limit

Before, the result: one click pulls all 301 unfetched neighbors onto the canvas while the toggle says a limit is applied:

before-limit-flood

After: same state, Expand is disabled until a valid limit is entered or the toggle is turned off:

after-limit

After, with a valid limit: entering 10 and expanding adds exactly 10 neighbors, so the normal flow is unchanged:

after-limit-flood

Clearing the limit field stored NaN, because parseInt("") returns NaN
and ?? only catches null or undefined. The expand request treats a
falsy limit as no limit, so the request went out unlimited while the
toggle still showed a limit was applied.

The limit state now stores null for an empty or invalid input, the
field renders empty instead of value={NaN}, and the Expand button is
disabled until a valid limit is entered or the toggle is turned off.
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.

Clearing the neighbor expansion limit field silently expands without a limit

1 participant