Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix files selection #4764

Merged
merged 9 commits into from
Aug 28, 2024
Merged

Fix files selection #4764

merged 9 commits into from
Aug 28, 2024

Conversation

PavelLaptev
Copy link
Contributor

@PavelLaptev PavelLaptev commented Aug 26, 2024

☕️ Reasoning

  • The selection using arrow keys didn't work on commits. It's because we didn't provide the commit id and there wasn't any matches.
  • Allow to select multiple files, except remote commits
  • disable draggable icon for unapplied commits

Result:

Screen.Recording.2024-08-26.at.23.44.57.mov

Related issue — #4734 (comment)

Copy link

vercel bot commented Aug 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gitbutler-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 26, 2024 9:20pm

@PavelLaptev PavelLaptev requested a review from mtsgrd August 27, 2024 11:29
Comment on lines 11 to 13
const nextFile =
fileIndex !== -1 && fileIndex + 1 < files.length ? files[fileIndex + 1] : undefined;
return nextFile;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is a no-op change?

Copy link
Contributor Author

@PavelLaptev PavelLaptev Aug 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm checking if fileIndex is greater than 0 and within the bounds of the files array. If both conditions are true, the code returns the next file in the array. Otherwise, it returns undefined.

Can you suggest a better solution here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only change you're making here is declaring the variable nextFile and then immediately removing it. Perhaps you meant to modify the expression?
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Sure, I'll fixed that

Comment on lines 16 to 19
return fileIndex > 0 ? files[fileIndex - 1] : undefined;
const previousFile = fileIndex > 0 ? files[fileIndex - 1] : undefined;
return previousFile;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed :-)

@PavelLaptev PavelLaptev merged commit 95d11a2 into master Aug 28, 2024
12 checks passed
@PavelLaptev PavelLaptev deleted the Fix-files-selection branch August 28, 2024 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants