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

Not able to identify RESQ nodes for non-root element #60

Closed
abhinaba-ghosh opened this issue Sep 21, 2020 · 9 comments
Closed

Not able to identify RESQ nodes for non-root element #60

abhinaba-ghosh opened this issue Sep 21, 2020 · 9 comments
Labels
bug Something isn't working needs repro

Comments

@abhinaba-ghosh
Copy link

abhinaba-ghosh commented Sep 21, 2020

RESQ version: 1.8.0

If root is used while fetching the resq nodes, it is able to identify the child elements. But, if non-root element is used, it is failing to identify the same. The attached screenshots will be more descriptive:

DOM:
Screenshot 2020-09-21 at 6 24 17 PM

Fetch Commands:
Screenshot 2020-09-21 at 6 19 23 PM
So, in first command it is not able to identify the child elements. Once the root is used, both the child products got identified.

@baruchvlz
Copy link
Owner

baruchvlz commented Sep 22, 2020

Hey @abhinaba-ghosh thanks for reporting this. Do you know if this happened in 1.7.1 as well? Also, could you provide a repo that I can clone and try this out.

@abhinaba-ghosh
Copy link
Author

hi @baruchvlz , yes, it is happening with v1.7.1 too. I am seeing this is happening if a component is getting mounted asynchronously. But it is still wired.

@baruchvlz
Copy link
Owner

I'll take a look at this. Again, thanks for reporting.

@abhinaba-ghosh
Copy link
Author

Hi @baruchvlz , sorry for pushing this in your busy schedule, but having an update about this issue would be pretty helpful.

@baruchvlz
Copy link
Owner

Hi @abhinaba-ghosh, I was trying to create a reproducible example for this, but was not able to.

I used this example:

import React from 'react';

import { resq$, resq$$ } from 'resq';

const Product = ({ text }) => (
  <div className="product">{text}</div>
);

const Container = () => (
  <div className="container">
    {
      ['Foo', 'Bar'].map((text, index) => <Product key={`${index}_${text}`} text={`${index}_${text}`} />)
    }
  </div>
)

function App() {

  React.useEffect(() => {
    window.$ = resq$;
    window.$$ = resq$$
  }, []);

  return (
    <>
      <Container />
    </>
  );
}

export default App;

image

As you can see in the image, i am able to retrieve both <Product /> components using the result from querySelector as well as the node from the result of using $('Container', root).

@abhinaba-ghosh
Copy link
Author

Hi Thanks for re-confirming. I will try with the v1.9.0. If still exists, I will share the codebase.

@abhinaba-ghosh
Copy link
Author

Hi @baruchvlz , some wired behavior after migrating to v1.9.0, byProps returning multiple nodes which is not the case with the earlier version. You can try out with this app.

Screenshot 2020-10-11 at 9 26 08 PM

@baruchvlz
Copy link
Owner

@abhinaba-ghosh Thanks for taking a look at v1.9.0. I'm not entirely sure why this is happening, but I tried out your last reported error with both sync and async approaches and could not reproduce.

Sync
Screenshot 2020-10-12 at 08 57 43

Async
Screenshot 2020-10-12 at 08 59 10

If you want to have a chat about this, feel free to reach out on Gitter.

@abhinaba-ghosh
Copy link
Author

working well in the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs repro
Projects
None yet
Development

No branches or pull requests

2 participants