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

[BUG] When using SSR I get a dom mismatch #649

Closed
izaacdb opened this issue Aug 12, 2020 · 6 comments
Closed

[BUG] When using SSR I get a dom mismatch #649

izaacdb opened this issue Aug 12, 2020 · 6 comments
Labels
wontfix This will not be worked on

Comments

@izaacdb
Copy link

izaacdb commented Aug 12, 2020

Describe the bug

When using NextJS I see
Warning: Expected server HTML to contain a matching <span> in <nav>. in span (created by Styled(styled.span)) in Styled(styled.span) (created by Pagination).
This warning only shows up when I use pagination.

To Reproduce

Steps to reproduce the behavior:

  1. npx create-next-app --example with-typescript-styled-components with-typescript-app
  2. yarn add react-data-table-component
  3. copy the example data table, add 11 records
  4. enable pagination
  5. yarn dev
  6. see error in console, compare view source to rendered code

Expected behavior

<span class="sc-fznxKY sc-fznMAR jMFmnk">1-10 of 537</span> should be rendered on server and client

Versions (please complete the following information)

  • next@9.5.1
  • styled-components@5.1.1
  • react-table@7.5.0
@izaacdb izaacdb changed the title [DESCRIPTION] When using NextJS I get a dom mismatch [BUG] When using NextJS I get a dom mismatch Aug 12, 2020
@izaacdb izaacdb changed the title [BUG] When using NextJS I get a dom mismatch [BUG] When using SSR I get a dom mismatch Aug 12, 2020
@erikt9
Copy link

erikt9 commented Aug 18, 2020

I've been unable to get SSR working with style-components@5, you may want to try version 4 and see if you have any luck with that. Also make sure to be using the babel-plugin-styled-components with your build if appropriate.

@izaacdb
Copy link
Author

izaacdb commented Aug 18, 2020

v5 seems to work fine for me other than this issue. I am using that plugin and some Babel configuration.

@jbetancur
Copy link
Owner

jbetancur commented Aug 19, 2020

TBH I have next to no experience using next.js. Is this just a warning or do things actually break Pagination? I'm really curious if there is some side effect with styled-components composition and nextjs. For example, the span that has the rows count Range is derived from a common span.

const Span = styled.span`
flex-shrink: 1;
user-select: none;
`;
const Range = styled(Span)`
margin: 0 24px;
`;

@stale
Copy link

stale bot commented Sep 18, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Sep 18, 2020
@stale stale bot closed this as completed Sep 26, 2020
@abdulsamadayoade
Copy link

Is there any fix for this @jbetancur @izaacdb . I've been facing this same issue for sometime now

@kayotimoteo
Copy link

same problem here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

5 participants