Skip to content

Prevents list from wrapping to end of list - #2539

Closed
iAmWillShepherd wants to merge 3 commits into
masterfrom
up-is-not-down
Closed

iAmWillShepherd wants to merge 3 commits into
masterfrom
up-is-not-down

Conversation

@iAmWillShepherd

Copy link
Copy Markdown
Contributor

Partially fixes issue #2479. Since the history list can pull more items on scroll, we never really know what the end is, so I ignored the down key wrapping.

@shiftkey

Copy link
Copy Markdown
Member

So if you try and key up from the first item in the branches list you encounter this:

Putting aside that this occurs post-launch and the messaging is off, maybe this solution isn't as easy as I'd hoped...

@iAmWillShepherd

Copy link
Copy Markdown
Contributor Author

Ah yea, these were the repercussions I was rambling about last night. Will do some more work to try to get it stable and keep the non wrapping stuff for the history list.

@iAmWillShepherd

Copy link
Copy Markdown
Contributor Author

I've done some digging and narrowed it down to these lines:

desktop/app/src/ui/list.tsx

Lines 334 to 339 in ad59267

if (this.canSelectRow(newRow)) {
return newRow
} else {
return this.nextSelectableRow(direction, newRow)
}
}

Since the first item in that list is a group header, canSelectRow returns false causing nextSelectableRow to be recursively called. That explains the stack overflow issue.

private canSelectRow = (index: number) => {
const row = this.state.rows[index]
return row.kind === 'item'
}

@shiftkey

Copy link
Copy Markdown
Member

Yeah, I'm having flashbacks to #996 where I found myself in this code due to some other corner cases with handling a filtered list.

@iAmWillShepherd

Copy link
Copy Markdown
Contributor Author

Doesn't seem like this is gonna go well for me then! 😨

@shiftkey

Copy link
Copy Markdown
Member

@iAmWillShepherd 👢?

@iAmWillShepherd

Copy link
Copy Markdown
Contributor Author

IDK what that means, but I'll try and get something working

@shiftkey

Copy link
Copy Markdown
Member

@iAmWillShepherd shall we boot this to some other time? It's very minor, and I question if it's worth it to spend too much time on it.

@iAmWillShepherd

Copy link
Copy Markdown
Contributor Author

Sure, we can deal with it later.

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.

2 participants