nexushoratio / userscripts

Random userscripts for browsers.
GNU General Public License v3.0
2 stars 0 forks source link

`Scroller`: Investigate if we still need the current item resets #212

Closed nexushoratio closed 11 months ago

nexushoratio commented 11 months ago

Reference (https://github.com/nexushoratio/userscripts/issues/144#issuecomment-1824830905)

Due to how some Pages rebuild their elements internally upon loading additional content, we added some resets to Scroller in the form of this.item = this.item. Do we still need them all of the time or can we make use of the MutationObserver to detect that situations that resulted in the need for them?

nexushoratio commented 11 months ago

This use of this.item = this.item is just happenstance. What really matters is invoking the getter via this.item. However, that upset the linter, so got changed to the assignment.

Part of the idea behind adding the goto() method was to replace those assignments with calls that could probably have an appropriate check, like this on in #onClick():

if (item !== this.item) {
  this.item = item;
}

Though, I suspect it should actually go into #bottomHalf().

nexushoratio commented 11 months ago

Resetting hearkens back to the days Scroller tracked by the actual HTML element, rather than the uid.

It may be the case that this really is not necessary any more.

This use also predates the existence of Scroller, so finding the related issues is tricky.

nexushoratio commented 11 months ago

I turned on all of my notifications again so I will have some data to work with.