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

TextField SSR: Warning: Prop id did not match. #1046

Closed
inomn opened this issue Feb 15, 2019 · 11 comments
Closed

TextField SSR: Warning: Prop id did not match. #1046

inomn opened this issue Feb 15, 2019 · 11 comments
Labels
Bug Something is broken and not working as intended in the system.

Comments

@inomn
Copy link

inomn commented Feb 15, 2019

Looks like TextField SSR doesn't work properly.
There is minimalistic layout:

<AppProvider>
    <Page title="Log in">
         <Card sectioned>
          <Form onSubmit={this.handleSubmit}>
            <FormLayout>
              <div className={s.row}>
                <TextField
                  placeholder="Enter your E-mail"
                  type="email"
                  name="email"
                  label="Email"
                  autoComplete={false}
                />
              </div>
              <div className={s.row}>
                <TextField
                  placeholder="Enter your password"
                  type="password"
                  name="password"
                  label="Password"
                  autoComplete={false}
                />
              </div>
              <div className={s.button}>
                <Button submit>Login</Button>
              </div>
            </FormLayout>
          </Form>
         </Card>
     </Page>
</AppProvider>

I'm getting error:

Warning: Prop id did not match. Server: "TextField15Label" Client: "TextField1Label"

If i remove label props, then error is about TextField id.
If i remove TextField at all, there is no errors (so Card, Button works fine).

Expected behavior

SSR works fine

Actual behavior

Warning: Prop id did not match.

Steps to reproduce the problem

  1. You can use SSR-boilerplate from kriasoft: https://github.com/kriasoft/react-starter-kit
  2. Make simple layout as shown above
  3. Watch to browsers console

Specifications

  • Are you using the React components? (Y/N): Yes
  • Polaris version number: tried 3.7.1 and 3.2.1
  • Browser: Google Chrome latest (mac)
  • Device: Macbook
  • Operating System: Mojave 10.14.3
@ghost
Copy link

ghost commented Feb 15, 2019

👋 Thanks for opening your first issue. A contributor should give feedback soon. If you haven’t already, please check out the contributing guidelines. You can also join #polaris on the Shopify Partners Slack.

@CommerceOwl
Copy link

I'm also seeing this.

@yourpalsonja yourpalsonja added ⚗️ Development Bug Something is broken and not working as intended in the system. labels Apr 18, 2019
@Tzelon
Copy link

Tzelon commented May 2, 2019

Me too

@EdvinasKilbauskas
Copy link

Same here

@gdayton
Copy link

gdayton commented Jun 12, 2019

Seeing the same issue as well

@gdayton
Copy link

gdayton commented Jun 21, 2019

I believe the problem has to do with the fact that the React app is being server side rendered. Inserting hooks to check and see if the componentDidMount/componentDidUpdate before displaying elements worked for me. Hope this helps!

import { useState, useEffect } from 'react';
const FooBar = () => {
  const [rendered, setRendered] = useState(false);
  useEffect(() => {
    setRendered(true),
    () => { setRendered(false); }
  });

  if(rendered)
    return (
      <div></div>
    );
  else 
    return <p>Loading...</p>;
}

@ghost
Copy link

ghost commented Dec 18, 2019

This issue has been inactive for 180 days and labeled with Icebox. It will be closed in 7 days if there is no further activity.

@ghost ghost added the Icebox label Dec 18, 2019
@ghost ghost closed this as completed Dec 25, 2019
@BPScott
Copy link
Member

BPScott commented Jan 4, 2020

Reopening this as SSR discrepancies are still an issue

@BPScott
Copy link
Member

BPScott commented Jan 11, 2020

Probot. No

@BPScott BPScott reopened this Jan 11, 2020
@BPScott BPScott removed the Icebox label Jan 11, 2020
@ghost
Copy link

ghost commented Jul 9, 2020

This issue has been inactive for 180 days and labeled with Icebox. It will be closed in 7 days if there is no further activity.

@ghost ghost added the Icebox label Jul 9, 2020
@ghost ghost closed this as completed Jul 16, 2020
@ghost
Copy link

ghost commented May 5, 2021

Having the same issue with ResourceList items. Looks like the issue is being addressed here: #1761

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken and not working as intended in the system.
Projects
None yet
Development

No branches or pull requests

6 participants