Repository navigation
Use correct file after merges in in restore-file - #6670
Conversation
fregante
left a comment
There was a problem hiding this comment.
I don't know exactly how to reproduce, it seems that the old "update branch" method no longer broke the feature. Maybe:
- Edit file in PR
- Edit in MAIN
- Change PR base to some random branch
- Change PR base back to MAIN (I think this basically recalculates the base commit and breaks
pr-base-commitwhile we're at it…) - Click "Discard changes"
Before
This video starts with an already-wrong restore situation. +2 was only added to main recently
Screen.Recording.9.mov
After
This also starts in that broken situation, but fixes it
Screen.Recording.10.mov
| if (editFile.closest('.file-header')!.querySelector('[aria-label="File added"]')) { | ||
| // The file is new. "Discarding changes" means deleting it, which is already possible. | ||
| // Depends on `highlight-deleted-and-added-files-in-diffs`. | ||
| return; |
There was a problem hiding this comment.
I dropped this exclusion. Our pattern is still faster than GitHub’s, which loads a whole new page and prompts for the commit title.
Screen.Recording.2.mov
| editFile.after( | ||
| <button | ||
| className="pl-5 dropdown-item btn-link rgh-restore-file" | ||
| style={{whiteSpace: 'pre-wrap'}} |
| observe('.js-file-header-dropdown a[aria-label^="Change this"]', add, {signal}); | ||
|
|
||
| // `capture: true` required to be fired before GitHub's handlers | ||
| delegate('.file-header .js-file-header-dropdown', 'toggle', handleMenuOpening, {capture: true, signal}); |
There was a problem hiding this comment.
No more toggle listeners please:
There was a problem hiding this comment.
Standard behavior still working, tested on https://github.com/refined-github/sandbox/pull/16/files
Screen.Recording.3.mov
|
YOL9T 🐈⬛ |
restore-fileoccasionally restores the wrong commit #4679This is the generated call: