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] Robust unique id - warning is not clear #4659

Closed
ddeath opened this issue Jul 9, 2016 · 10 comments
Closed

[TextField] Robust unique id - warning is not clear #4659

ddeath opened this issue Jul 9, 2016 · 10 comments
Labels
component: text field This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation

Comments

@ddeath
Copy link
Contributor

ddeath commented Jul 9, 2016

Problem description

I just started getting warnings: Warning: We don't have enough information to build a robust unique id for the TextField component. Please provide an id or a name.

The problem with this warning is that it does not provide much information. In stack trace is TextField - but I use only 3 TextFields in app and all of them have id provided.

So it means that some others components from material-ui are using the TextFields and they do not provide id to them.

Steps to reproduce

    import React from 'react';
    import ReactDOM from 'react-dom';
    import injectTapEventPlugin from 'react-tap-event-plugin';
    import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
    import AutoComplete from 'material-ui/AutoComplete';

    injectTapEventPlugin();


    ReactDOM.render(
      <MuiThemeProvider>
        <AutoComplete
          dataSource={[]}
          searchText="aa" />
      </MuiThemeProvider>
      ,
      document.getElementById('app'),
      () => {
      }
    );

Versions

  • Material-UI: 0.15.1
  • React: 15.1.0
  • Browser: Version 53.0.2774.3 dev (64-bit)

Description

At least it should be specified in docs that autocomplete have to have id otherwise you will get an warning

Images & references

textfield_error

@radek-t
Copy link

radek-t commented Jul 16, 2016

Just found out that the same warning shows up as soon as you start using the DatePicker

@PsychoLlama
Copy link

Just started using this library, and we're seeing the same warning. We're using the material-ui/TimePicker component.

@slackday
Copy link

Same when trying to use AutoComplete set up as in the documentation http://www.material-ui.com/#/components/auto-complete

@mpontikes mpontikes mentioned this issue Aug 5, 2016
13 tasks
@aaj
Copy link

aaj commented Aug 28, 2016

Same here :(

@leialexisjiang
Copy link

warning(name || hintText || floatingLabelText || id, We don't have enough information to build a robust unique id for the TextField component. Please provide an id or a name.);
the code found in TextField that used in AutoComplete, so just add hintText or floatingLabelText in AutoComplete fix this issue

@remon-nashid
Copy link

remon-nashid commented Oct 19, 2016

Great find @raycursif! The issue is, some components like DatePicker only use floatingLabelText and id from the attributes above. Sometimes a label is not desired and I'd like to keep id creation for material-ui. In any case, error message needs to be more explicit.

update
I set hintText on TimePicker component (hint text is 'From'). Here is the resulting id: undefined-From-undefined-7408

@mcst
Copy link

mcst commented Dec 8, 2016

I have this issue but I am not using the TimePicker.

@oliviertassinari oliviertassinari added the component: text field This is the name of the generic UI component, not the React module! label Dec 18, 2016
@oliviertassinari oliviertassinari changed the title Robust unique id - warning is not clear [TextField] Robust unique id - warning is not clear Dec 18, 2016
DictumMortuum added a commit to DictumMortuum/dictum-dev that referenced this issue Mar 9, 2017
@jeveloper
Copy link

It's an old post, but i thought a fix is simple:

Although the message is confusing, this is relevant to DatePicker and TimePicker

Just add a unique id

.... id='uniqueid' ...

@oliviertassinari
Copy link
Member

We have been porting the component on the v1-beta branch. We reimplemented it from the ground-up. It's fixed.

@tiggem1993
Copy link

Thanks @jeveloper

Issue FIXED!!! after declaration of id in DatePicker.

<DatePicker id="bdaypicker" ref="datePickerStartDate" container={"dialog"} onChange={that.handleDateChange} maxDate={new Date()} autoOk={true} textFieldStyle={{ display: "none" }} />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: text field This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation
Projects
None yet
Development

No branches or pull requests