fix: block neighbor expansion while the limit input is empty - #2069
Open
vishwakt wants to merge 1 commit into
Open
fix: block neighbor expansion while the limit input is empty#2069vishwakt wants to merge 1 commit into
vishwakt wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2068
Clearing the limit field stored
NaN, becauseparseInt("")returnsNaNand??only catchesnullorundefined. 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
nullfor an empty or invalid input, the field renders empty instead ofvalue={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
mainhad 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, the result: one click pulls all 301 unfetched neighbors onto the canvas while the toggle says a limit is applied:
After: same state, Expand is disabled until a valid limit is entered or the toggle is turned off:
After, with a valid limit: entering 10 and expanding adds exactly 10 neighbors, so the normal flow is unchanged: