dis-moi / extension

:speech_balloon: Never browse alone again
https://www.dismoi.io/
Other
42 stars 11 forks source link

Matching engine re-rerun limitation #846

Open zhinu opened 3 years ago

zhinu commented 3 years ago

Describe the feature/improvement As of now, the extension waits for the source code to load and then looks for requested xpath occurrences to display a bubble. It also rechecks the code when you make the window active again. In many websites, new content can be loaded on the same page after a certain actions (wait, click, scroll etc...), thus modifying the page source code. It happens for youtube or amazon comments that gets loaded only when the user scrolls down the the proper section. Unfortunately, dis-moi will only scan the source code once. The improvement will aim at having the extension understanding when a source code modification occurs while on the page, and launching a rescan for xpath occurences.

Target user The end-user will then benefit from having better and more contextualized bubbles.

zhinu commented 3 years ago

An example is with this link : https://www.darty.com/nav/extra/offres?codic=4738454

the extension in staging (with amazon antidote) should have a bubble pop up when clicking on "OFFRE RECONDITIONNEES (10)". However it doesn't show. only if you go to another tab and come back to the tab!

The Xpath is

//*[@id='state_1'][contains(@class, 'liste_par_etat visible')]

It looks for a new value in a class. Which doesn't appear by default

christpet commented 3 years ago

@lutangar @felix-lambert could one of you take a stab at figuring out the general size of fixing this bug? XS - S - M - L - XL

lutangar commented 3 years ago

It also rechecks the code when you make the window active again.

It's also triggered on each URL change if I'm correct, so it's suppose to work on website taking care of changing the URL when the user opens a tab (so called SPA and friends). But as you're clearly stating this is flawed and doesn't cover every use-cases.

One possible implementation of your suggestion could rely on MutationObserver

See also timer throttling to limit cpu consumption: https://developer.chrome.com/blog/timer-throttling-in-chrome-88/#state-polling

lutangar commented 3 years ago

Dom changes should only be observed to rerun the xpath matching, not the entire matching engine.