aurelia / aurelia/ui-virtualization

Conditional statement 'bug'

Open
#243 7 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
TypeScript
Stars
89
Forks
44
PR merge metrics
No merged PRs in 30d

Description

**General info**
* Version: 1.0.0-rc3

**Issue**
After reviewing the newest version of the code, the following conditional statement has an issue in the second case (line 921-922).
```
if (new_range_start_index >= old_range_start_index && old_range_end_index === new_range_end_index
|| new_range_end_index === old_range_end_index && old_range_end_index >= new_range_end_index) {
```

The second case `new_range_end_index === old_range_end_index && old_range_end_index >= new_range_end_index` equals comparison does not make sense . The intention of the case is to test for 'near top', to mirror the case of 'near bottom'. By mistakenly referring to the end-ranges in the equals comparison, it fails to be a 'near top' test, and instead sort of nullifies the second case.

**Fix**
The second case should instead be changed to `new_range_start_index === old_range_start_index && old_range_end_index >= new_range_end_index`

Contributor guide

Open the contributing guide

Research direction

Locate the conditional at lines 921-922 and compare its second case with the issue's stated near-top intent. Verify the corrected comparison against the surrounding range logic and existing tests, if present. Done means the second case checks the start indices as described and the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.