question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Autocomplete] onOpen callback invoked twice

See original GitHub issue
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

I’m using @material-ui/lab v4.0.0-alpha.36. It seems that onOpen callback of Autocomplete components is getting invoked twice when clicking into field.

Example of the component usage:

<Autocomplete
      value={props.value}
      options={props.options}
      loading={props.loading}
      multiple={props.multiple}
      renderInput={params => (
        <TextField
          {...params}
          fullWidth
          name={props.name}
          label={props.label}
          onBlur={props.onBlur}
          InputProps={{
            ...params.InputProps,
            endAdornment: (
              <>
                {props.loading ? <CircularProgress color="inherit" size={20} /> : null}
                {params.InputProps.endAdornment}
              </>
            ),
          }}
        />
      )}
      onOpen={() => console.log('on open')} <-- this is printed twice
      onChange={handleChange}
      getOptionLabel={option => option.label}
      getOptionSelected={(option, value) => option.value === value}
    />

Expected Behavior 🤔

onOpen callback should be invoked only once.

Steps to Reproduce 🕹

Steps:

  1. Use Autocomplete component.
  2. Provide onOpen callback.
  3. Click into the field.
  4. See that onOpen invoked twice.

Context 🔦

Your Environment 🌎

Tech Version
Material-UI v4.0.0-alpha.36
React v16.12.0
Browser Chrome
TypeScript -
etc.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
oliviertassinaricommented, Dec 17, 2019

I have added the waiting for users upvotes tag. I’m closing the issue as we are not sure it’s important. So please upvote this issue if you are. We will prioritize our effort based on the number of upvotes.

0reactions
oliviertassinaricommented, Sep 20, 2020

Please provide a minimal reproduction test case. This would help a lot 👷 . A live example would be perfect. This codesandbox.io template may be a good starting point. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Autocomplete] onOpen callback invoked twice #18891 - GitHub
Current Behavior 😯​​ It seems that onOpen callback of Autocomplete components is getting invoked twice when clicking into field.
Read more >
jquery autocomplete open function getting called twice
The problem I am having is that when I delete the autofilled/autoselected part by pressing delete, the open function runs again for some...
Read more >
Autocomplete API - Material UI - MUI
Name Type Default options * array renderInput * func autoComplete bool false
Read more >
MUI Autocomplete: How to prevent open on focus, instead ...
Below is a working example of one way to do this. This specifies the onOpen, onClose, onInputChange, open, and inputValue props in addition...
Read more >
UIAutocomplete (RichFaces Framework 5.0.0.Alpha2 API)
Javascript code executed when a pointer button is double clicked over this element. String · getOnerror(). The client-side script method to be called...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found