sindresorhus/refined-github

Copy button doesn't show (and other file-related features) #3945

munael posted onGitHub

<!-- Thanks for reporting a bug! ⛰ 1. Make sure the bug is caused by Refined GitHub. Try disabling the extension first. 2. Include a full URL where the bug appears. 3. Include a screenshot/gif Issues without a URL/screenshot will be closed -->

E.g.: https://github.com/TRSasasusu/SpikingMoYF/blob/master/network.py image


I found this too. It appears after a refresh. It probably has something to do with Ajax navigation

posted by fregante about 4 years ago

This issue is very complex. Basically any time you navigate from a file selection any feature that needs to run does not. This includes not just features that are within the file box. Even fork-to is affected.

posted by yakov116 about 4 years ago

Even fork-to is affected.

I don’t think so, that area is not updated when navigating the files, so the RG changes aren't lost nor do they need to be re-applied.

gif

This issue is very complex

This issue just means that we can't rely on has-rgh to deduplicate our features. Fixing this would mean making features.add aware of which features need to be run on filelists as well and having their own filelist-has-rgh file.

I think it's easier to just use per-feature checks on filelist features, as described in https://github.com/sindresorhus/refined-github/pull/3968#discussion_r574831236

posted by fregante about 4 years ago

I don’t think so, that area is not updated when navigating the files, so the RG changes aren't lost nor do they need to be re-applied.

When going to a single file fork-to is supposed to link to the file on the fork. (Maybe I am mixing up feature nanes)

posted by yakov116 about 4 years ago

Ah crap, you may be right. The URL isn't updated.

It appears that the issue affects every feature on files and filelists. Another example:

  1. Visit https://github.com/sindresorhus/refined-github/find/main
  2. Type forkedto
  3. Open the feature
  4. No rgh-feature-descriptions enabled 😕
  5. Refresh the page
  6. There it is…

I'm afraid we'll have to drop has-rgh, or at least figure out how many features are affected by this bug.

As a temporary solution, once again, my suggestion still works. The alternative (dropping has-rgh) would mean that, if we forget to handle deduplication, we'll end up with duplicates. Whereas in the current situation, if we don't catch these issues, the features just silently fail. I prefer the latter, probably. 🤷‍♂️

posted by fregante about 4 years ago

Just FYI, navigation through Octotree does pair nicely with Refined GitHub (sadly they are closed source now, so it doesn't help much).

posted by kidonng about 4 years ago

What do you mean by "pair nicely"? If I remember correctly OctoTree implemented its own loading mechanism (for no good reason) so many other extensions didn't work because of it. I don't know if that has been changed since.

posted by fregante about 4 years ago

navigation through Octotree does pair nicely with Refined GitHub

+1

I've been using the paid version of Octotree for a few months now, and it works great. RGH features are correctly enabled whenever navigating between files, there's no need to reload the page.

Afaik it seems to use the native GH navigation (or at least some kind of AJAX navigation) because the page is never fully reloaded.

posted by cheap-glitch almost 4 years ago

I have never used octo but am I correct they only need to monitor the tree part of github? We need to monitor the whole page.

What about about we add a config called repeatWhereNotExist: 'selector here' and do a select.exists on run?

I know this is a bit manual but it can work until we find a good solution.

posted by yakov116 almost 4 years ago

If I remember correctly OctoTree implemented its own loading mechanism (for no good reason) so many other extensions didn't work because of it.

If you are referring to ovity/octotree#490, that has been fixed a long time ago.

I don't know if that has been changed since.

It certainly does, but we won't know exactly how now 🤷‍♀️

posted by kidonng almost 4 years ago

I think I know why it works with octotree: they load the whole page as GitHub used to do before. The issue here doesn’t apply because GitHub replaces part of the page, leaving has-rgh untouched.

@yakov116 that’s an interesting solution, which basically standardizes what we already do manually inside init in some cases.

Either way I’d like this issue fixed before the next release, so if no one opens a PR with their solution I will

posted by fregante almost 4 years ago

@yakov116 that’s an interesting solution, which basically standardizes what we already do manually inside init in some cases.

Exactly my thought.

Either way I’d like this issue fixed before the next release, so if no one opens a PR with their solution I will

Do you like my idea? or do you want another idea.

posted by yakov116 almost 4 years ago

Yeah, either one could work. It could even be merged with the existing deduplication key: deduplicate: 'selector' for your suggestion and deduplicate: true for the current behavior (equivalent to deduplicate: 'has-rgh')

posted by fregante almost 4 years ago

I want to finish up my other PR(s) so your free to take this. If not I can try sometime next week.

posted by yakov116 almost 4 years ago

onetime could also be merged into the same property if it makes sense, since it's also used to avoid running multiple times, but naming the option might be tough. Maybe:

- init: onetime(init)
+ deduplicate: 'once',
+ init
- repeatOnBackButton: false,
+ deduplicate: 'auto',
- if (select.exists('.rgh-selector')) {
-     return false;
- }
...
+ deduplicate: '.rgh-selector',
posted by fregante almost 4 years ago
posted by yakov116 almost 4 years ago

There's no deduplication there, they're just tracking the URL in an unnecessarily-complex way (we do the same by just listening to pjax:end)

posted by fregante almost 4 years ago

show-whitespace seems to be missing too

  1. Open https://github.com/sindresorhus/refined-github/tree/main/build
  2. Open file
  3. See no whitespace
  4. Refresh oage
  5. See whitespace

gif

posted by fregante almost 4 years ago

Fund this Issue

$0.00
Funded

Pull requests