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

Styles gone after revisting page #610

Closed
Joseppi83 opened this issue Jun 17, 2020 · 5 comments
Closed

Styles gone after revisting page #610

Joseppi83 opened this issue Jun 17, 2020 · 5 comments

Comments

@Joseppi83
Copy link

Joseppi83 commented Jun 17, 2020

So I'm using react-tooltip for a register form. When I redirect to the login page, then redirect back to the register page with the register form, all the styles are gone from the tooltips. The text and css transitions still function, but the background and text color is gone.

I rebuild the tooltip bindings in useEffect with the following:
useEffect(() => { ReactTooltip.rebuild(); });

Anyone having similar problems?

@Joseppi83
Copy link
Author

So it looks like on the redirect from register to login and back to register, that the tooltip's div element is being assigned a different hashed class. The styles are in the console, but it's assigned to a different hashed className.

@faahim
Copy link

faahim commented Jul 6, 2020

Having the mismatched hashed class name issue too. No style is being applied because the class name in <style> and the class name on the element doesn't match.

@s-ashwinkumar
Copy link

s-ashwinkumar commented Jul 6, 2020

@faahim Had the same issue.To circumvent it for now, pass a 'uuid' prop to the styling component and it will not generate one on its own on re-render. Haven't seen anything break because of this fix.... yet.
<ReactTooltip uuid="<some-uuid-here>" />

@Joseppi83 thanks for raising this. Helped me zero in on the temp fix.

PS : Found the source issue which allows us to do the aforementioned fix - #580 which is what led to adding the use of a prop uuid.

@faahim
Copy link

faahim commented Jul 6, 2020

@s-ashwinkumar Woo, thanks so much for all those info! When I saw it has mismatched hashes, I felt like, gosh, if it generates new ones every time, and it can go wrong, then it will go wrong at least some of the time. I know it can be reliable (UUID looks like a solid fix here), but my OCD brain wouldn't give me the peace of mind. 😅

I'm overriding the stylings with a custom class name for now. But will use uuid approach next time.

Thanks a ton!

@frmysantana
Copy link

Is there a more permanent fix? I'm seeing this happen already in my dev environment with only a few tooltips. I tried the uuid approach, but that actually broke more tooltips.

Overriding the styles with custom classes seems to work far better.

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

No branches or pull requests

5 participants