Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Observables: search inside added/removed nodes #548

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

horacio-penya
Copy link

We're working with pages that are rendered depending on API requests, so we do something like this:

  {
    selector: '#create_question',
    content: 'Click on + Query',
    highlightedSelectors: ['#create_question'],
    mutationObservables: ['#create_question'],
    resizeObservables: ['#create_question'],
  },

Because of some interaction between react-dom and Intersection Observer API that I don't really understand, mutationObservables is not deterministic, sometimes it gets the element I'm looking for (<div id="create_question">...</div>), sometimes it gets an ancestor (<div ...>...<div id="create_question">...</div>...</div>) and not always the same ancestor. When it gets an ancestor, it doesn't match the selector and so it doesn't refresh.

This PR makes Observables search inside the added/removed elements instead of just looking at them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant