-
Notifications
You must be signed in to change notification settings - Fork 1
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
Uncaught Error: Must provide a ref to the DOM element to be observed. #4
Comments
Thanks @csantiago132. So, that's weird. Unless I'm missing something it seems like you're doing everything right so I'm not sure why your seeing that error. Could you provide the repo for me to look at?
Nope, you could do the following: <section ref={mapRef} className="featured-projects">
{isInView && (
<ProjectPreview
number="01"
project={projectTest}
link="/"
mainImage={mainImage}
/>
)}
</section> |
@jscottsmith sure and thanks! ill add you since I have it private at the moment, branch is under |
Hmm, ya this seems likely to be SSR related. Was the following thrown on the client or server?
I can't seem to get that Error you were seeing -- instead I'm getting the following error which seems to be caused by a prop validation I used in the the Observed component.
I'll do some SSR testing today and see if can get a patch started. |
@jscottsmith both
^^ on the web console
^^on the terminal I even tried to pass options={{
root: document.viewport,
...}} but got nothing thanks again for the time taken |
Ya, it's actually due to the Published a fix for the SSR issue but it seems unrelated as I'm still seeing the error in your project. Edit: Actually, I'm thinking it may be due to how your project is setup. Something unique is happening in your build where the Maybe you have an idea of why this is happening? Note that you can work around this behavior by just observing a |
@jscottsmith I think that maybe it’s the Loadable component I’m using to async load components/code split the app. I’ll try and use your SSR fix and Call the component without it. If this is the cause, I’ll let you know so you can be aware/add it to the README. I’ll get back to you tonight and let you know any updates. Thanks again!! |
ok so basically, the best use-case for |
closing since there is support for SSR now and theres a fix for it, also, its due to my environment/setup and its not related to this plugin. Thanks again for everything! EDIT:Its due for using Note to future-self:Do not async load the container with
|
Good to know, thanks for the update on the |
thank you for taking the time to see the code and help to solve this promptly! also, @jscottsmith are contributions welcomed? I ran into a pickle running unit test on Enzyme, I can add it to the README if you like. here's what you have to do to make the unit test pass const renderedComponent = shallow(<MyComponentToBeTested isInView />); simply pass the |
@csantiago132 Of course, contributions are more than welcome. I'm not totally sure if the enzyme test is relevant enough to be documented but if you have an idea just open a PR and we can discuss there. It could definitely be helpful to document some of these scenarios that may be more commonly encountered. |
Amazing plugin and thanks for open-sourcing this! maybe im doing something wrong but im folowing the instructions and getting an error
this is the main container
and this is the component wrapped in it, its a stateless pure function component
Also, do I need the ternary operator? can I leave it blank just to render it if in view? thanks again for the help in advance
The text was updated successfully, but these errors were encountered: