Refined-github: Hide inactive deployments and lazy loaded content

Created on 5 Apr 2018  路  2Comments  路  Source: sindresorhus/refined-github

The hide inactive deployments feature (that I contributed myself in #1149) hides messages about inactive deployments in the timeline.

In long PRs, some items are collapsed and can be lazy loaded:

grafik

If these include inactive deployments, they aren't hidden:

grafik

This is because the feature reload only fires when .js-discussion's node list changes. With lazy loading, the deployments aren't direct descendants of .js-discussion, but of its descendant .progressive-timeline-item-container.

You can prove this by manually removing a .js-timeline-item using dev tools:

  • If it was loaded using Load more ..., the feature doesn't reload.
  • If it was already there at page load (and therefore is a direct descendant of .js-discussion), the feature does reload and inactive deployments become hidden.

So we have to tweak the observeEl function call:

  • subtree: true would solve this, but is probably too expensive
  • Watching all .progressive-timeline-item-container could work too, but the simplified-element-observer module only allows observation of a single node. We could extend this module, though.

Do you have another idea?

Here's an example PR: https://github.com/OpenLightingProject/open-fixture-library/pull/425

bug help wanted

All 2 comments

This affects all the other discussion features as well so we'd need a generic "discussion listener" that can be used across the extension.

By looking at GitHub's code (I just search .class names in the dev tools) I found that it should trigger a page:loaded event when the ajax pieces are loaded, so we can just listen to them. This might even replace any other observeEl we have in place for "recent comments pushed via ajax"

we'd need a generic "discussion listener" that can be used across the extension.

This has been added: https://github.com/sindresorhus/refined-github/blob/master/source/libs/on-new-comments.js

@fxedel do you want to take a stab at it? I don't have any repos with deployments

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vanniktech picture vanniktech  路  3Comments

Arcanemagus picture Arcanemagus  路  3Comments

olso picture olso  路  3Comments

fregante picture fregante  路  3Comments

Celthi picture Celthi  路  3Comments