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

Enable file-finder-buffer everywhere #4441

Merged
merged 2 commits into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/features/file-finder-buffer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function pjaxStartHandler(event: CustomEvent): void {
<span className="flex-self-stretch mr-2">{bufferField}</span>
);
bufferField.focus();
for (const element of select.all('.pagehead-actions, .rgh-ci-link, .octotree-bookmark-btn')) {
for (const element of select.all('.pagehead-actions, .rgh-ci-link details, .octotree-bookmark-btn')) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Since .rgh-ci-link is applied to the wrapper around the title, this was effectively removing the whole thing (including the inserted buffer).

element.remove();
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/features/repo-wide-file-finder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async function init(): Promise<void> {
<a
hidden
data-hotkey="t"
data-pjax="true"
data-pjax="#js-repo-pjax-container"
Copy link
Member Author

Choose a reason for hiding this comment

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

Setting the data-pjax attribute to true caused the hotkey to trigger a "real" navigation instead of an AJAX one, so the handlers added by file-finder-buffer weren't called.

This is probably because the element is inserted outside the main "container" (as opposed of the native hotkey which is located on the "Go to file" button).

Fixed it by changing the value of the attribute, mimicking the native link in the repo name heading:

<a data-pjax="#js-repo-pjax-container" href="/sindresorhus/refined-github">refined-github</a>

But this could also probably be fixed by inserting the link element directly inside the container.

href={buildRepoURL('find', await getDefaultBranch())}
/>
);
Expand Down