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 navigation issues in file explorer #6552
Fix navigation issues in file explorer #6552
Conversation
download-folder-button
duplicating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately it's not that easy. The issue is not strictly related to download-folder-button
so, if you want to look into it, you'd have to make sure that the logic in the feature manager is correct.
Another feature affected is:
void setupPageLoad(id, details); | ||
} | ||
}); | ||
for (const eventType of ['turbo:render', 'soft-nav:render']) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both of these events are called when clicking one of the repos tabs, for example when you click on Issues. This means you're running every feature twice on every page load.
Also, neither one is called when you:
- Open https://github.com/refined-github/refined-github/tree/main/.github/workflows
- Go up one folder
- Go back in browser history ❌
- Go forward in browser history ❌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ironically this feature is being duplicated here because our selector observer keeps working regardless of page changes, so it targets the "More options" dropdown every time React (mistakenly) regenerates it.
I might push a fix specific to this feature, but the lack of a global file listener is still unresolved. I think that as a starter, we need to replace turbo:render
with soft-nav:render
. Then maybe we can address the lack of browser history support by adding popstate
listeners, but those need to be deduplicated when soft-nav:render
is also fired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might push a fix specific to this feature
I "fixed the duplication" by using [title="More options"]:not(:has(+ .rgh-download-folder-button))
, but this means that the old button is left in place, pointing to the old folder. 🥲
Let's move the discussion to:
'[aria-label="Add file"] + details', // TODO: Drop in mid 2023. Old file view #6154 | ||
], add, {signal}); | ||
} | ||
|
||
void features.add(import.meta.url, { | ||
include: [ | ||
pageDetect.isRepoTree, | ||
pageDetect.isSingleFile, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a hack, a feature should not be enabled on random pages just to cleanup after itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but add singleFile is needed.
When we access blob direct link, Download button will not be rendered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feature must appear exclusively on directories because it downloads directories and the include
array tells me exactly that.
It's only "needed" here because the feature manager is broken, but it's still a hack that we should not use
I'm closing this PR because nothing can be used here unfortunately. If you'd like, maybe you can verify whether we can safely replace |
I'm reopening this in case you want to keep experimenting or proposing new AJAX solutions |
download-folder-button
duplicating
Closing for now. If you have any suggestions let me know |
Description
download-folder-button
duplicated #6414Test URLs
https://github.com/refined-github/refined-github/tree/main/source/features
Screenshot
Before
The button is duplicating and get pushed out to left
After
Remove previous button and stay the button right position.
Also, create button when accessing not only
repo-tree
but alsosingle-file