Skip to content

Fix: Features are not being applied on page change - #4571

Merged
fregante merged 6 commits into
refined-github:mainfrom
cheap-glitch:fix-pjax-navigation
Jul 18, 2021
Merged

fregante merged 6 commits into
refined-github:mainfrom
cheap-glitch:fix-pjax-navigation

Conversation

@cheap-glitch

@cheap-glitch cheap-glitch commented Jul 16, 2021 •

Copy link
Copy Markdown
Contributor

Fixes #4567

Test URLs

Navigate using PJAX, e.g.:

All features should work properly, and features affecting the repo header (e.g ci-link, quick-repo-deletion) should be properly deduplicated.

Screenshot

capture-1626426371.mp4

@yakov116 yakov116 added the bug label Jul 16, 2021

@fregante fregante left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome! Thanks to this we can also drop many of the custom deduplicate selectors we added for #3945

Comment thread source/features/index.tsx Resolved
Comment thread source/features/ci-link.tsx Outdated
pageDetect.isEmptyRepo,
],
awaitDomReady: false,
deduplicate: 'has-rgh',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why? This should be the default.

@cheap-glitch cheap-glitch Jul 17, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The new default for deduplicate is undefined, which means to check both has-rgh and has-rgh-inner. IMO this makes sense for the new default since most features need to be aware of both.

But since more-dropdown affects the DOM outside of #repo-content-pjax-container, we want it to look at has-rgh only. Otherwise when has-rgh-inner is removed it will run again, even though the repo header hasn't changed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Then my suggested logic doesn't work. The intent was to create logic that works for every feature, but if as you say features need to specify which deduplicator to use, then the logic is no longer sound.

@cheap-glitch

Copy link
Copy Markdown
Contributor Author

we can also drop many of the custom deduplicate selectors we added for #3945

Same PR?

@fregante fregante left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think everything here needs to be undone. I can't merge this PR as is because it changes the default behavior for all the features. That requires testing of every feature and it's not practical.


In short the problem is that we receive a "page updated" event but we don't know which part updated and which elements are still on the page. I don't think this detection can be automated.

For now we can take the same exact approach we took for #3945: Marking each currently-broken feature with a custom selector. However this new selector can probably be has-rgh-inner instead of using one per feature.

we can also drop many of the custom deduplicate selectors we added for #3945

Same PR?

You're right that's not urgent. Later. We'll clean this all up after we fix Refined GitHub.

Comment thread source/features/index.tsx Resolved
@fregante

fregante commented Jul 17, 2021 •

Copy link
Copy Markdown
Member

Thoughts? Alternative solutions?

If this works well for you without breaking other features, then we could also merge it and clean it up later. 😅 I just worry that it fixes some features and breaks others.

@cheap-glitch

Copy link
Copy Markdown
Contributor Author

It does work well as far as I've seen, but I do agree that changing the default for every feature is a risky move. I still thinks it makes sense as a default though.

For now I'll change this PR to add deduplicate: 'has-rgh-inner' to all the features that need it, so we can merge this knowing for sure we fixed more than we broke 😃

@cheap-glitch

Copy link
Copy Markdown
Contributor Author

Okay, I've combed through the output of

rg --files-without-match 'deduplicate:' source/features/*.tsx | sort

and quickly tested every feature I added the new deduplication to.

There might be a few tricky cases where this doesn't cut it entirely, e.g. I've noticed bugs-tab is partially broken (I'll open an issue about it). But otherwise this fixes most broken features (for now). Also, PR-related features don't seem affected by this new navigation (yet).

@fregante
fregante merged commit ac1293a into refined-github:main Jul 18, 2021
@fregante

Copy link
Copy Markdown
Member

Excellent! Version coming! Let’s see how it works in the field. Thanks for working on this!

@cheap-glitch
cheap-glitch deleted the fix-pjax-navigation branch July 18, 2021 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

Features are not being applied on page change

3 participants