Clearing the neighbor expansion limit field silently expands without a limit
- Dominant language
- TypeScript
- Stars
- 481
- Forks
- 108
- Avg merge
- 6d 8h
- Merged PRs (30d)
- 5
Description
## Description
In the Expand sidebar, the "Limit returned neighbors" input mishandles an empty value. The change handler in `NodeExpandFilters.tsx` is:
```ts
onChange={e => onLimitChange(parseInt(e.target.value) ?? 0)}
```
`parseInt("")` returns `NaN`, and `??` only catches `null` or `undefined`, so `NaN` is stored as the limit. The expand request is then built with `limit: limitEnabled && limit ? limit : undefined` in `NodeExpandContent.tsx`, where `NaN` is falsy, so the request goes out with no limit at all while the toggle still shows a limit is applied. The input also renders with `value={NaN}`, which React warns about.
## Environment
All environments, any connection type.
## Steps to Reproduce
1. Open the Expand sidebar on a node with unfetched neighbors
2. Keep "Limit returned neighbors" enabled and clear the limit field, which happens naturally when selecting the current value to type a new one
3. Click Expand before entering a new value
## Expected Behavior
The toggle state and the actual request agree: with the limit enabled, expansion either waits for a valid value or is blocked.
## Actual Behavior
The request is sent unlimited. On a large database this pulls unbounded neighbors in one click while the UI indicates a limit is in effect.
## Proposed Fix
Store `null` for an empty or invalid input so the field can render empty, and disable the Expand button while the limit is enabled but invalid. I have a fix with a component test ready and will open a PR shortly.
Contributor guide
Research direction
Start with the change handler in NodeExpandFilters.tsx and the request construction in NodeExpandContent.tsx, then review the component test mentioned in the issue. Confirm the empty or invalid field renders safely, the Expand action is unavailable while an enabled limit is invalid, and valid limits remain applied to the request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100