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.

BUG: FastField causes race condition on Chromes autofill

See original GitHub issue

This is a bug

Current Behavior

When doing autofill (autocomplete) multiple times, FastField sometimes doesn’t register the change on the field where the autofill is used. At other times, when a new value from autofill is selected, the old one pops right back. I suspect that this is some sort of race condition.

Additional Information

You have to play around with it a little bit to see this happening. Make sure you have at least two autofill options to reproduce and switch between them to see old value appearing.

Video: https://www.youtube.com/watch?v=869xNEs6fe0


  • Formik Version: 1.0.0-alpha.4
  • React Version: ^16.3.1
  • TypeScript Version: None
  • CodeSandbox Link: https://codesandbox.io/s/qqlkvpwpz6
  • OS: OS X
  • Node Version: v8.9.0
  • Package Manager and Version: Yarn 1.3.2
  • Browser: Chrome 65.0.3325.181

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aaronnuucommented, May 1, 2018

This issue is due to the fix to allow FastField to accept values from the formik context as it changes. This was needed since you couldn’t imperatively set values using the setFieldX methods, however my suggested fix to add a componentWillReceiveProps method broke a few other things.

It will only happen if auto-fill is changing more than one field but since it doesn’t blur the field that is currently focused after changing it’s value but it does for the other fields, the changes for those fields will propagate up to formik, the focused FastField will receive new props which will contain the previous value and since that is different to it’s current value it will swap back to that.

It’s also an issue if the Form happens to re-render while the user is typing.

I’ve thought about it a little bit and now I would suggest the FastField to be the source of truth for it’s own values and errors rather than the context of the form. This would mean removing the componentWillReceiveProps from FastField and using the same subscription logic as the reset function to setValues and setErrors on FastFields.

I can submit a PR for this soon I just have to get my head around TypeScript a little more to be sure I’m not doing something dumb.

0reactions
stale[bot]commented, Oct 21, 2018

ProBot automatically closed this due to inactivity. Holler if this is a mistake, and we’ll re-open it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is this an autofill bug on Chrome 81? - Super User
1 Answer 1 ... The named fields in an HTML form are stored with their values by the browser in the user's profile,...
Read more >
Untitled
Ch mangot vulcin, Dr1-c form, Psp disease causes, Steelheads hockey parking, ... Esmeriles bosch precios, Eastfield avenue alkrington, Nyhetene nett tv, ...
Read more >
Untitled
Novia ahogada, Idealista alquiler alcobendas, Red ant like bugs in garden ... Sick around the world pbs full documentary, Sulky racing cart, Lacetti...
Read more >
Untitled
Cheap race cars for sale in michigan, Kreissparkasse osterholz vorstand, ... Lei black shoes, Wobbler disease, Sport bakkie accessories south africa, ...
Read more >
Untitled
Jenni rivera su adios, Ruby goodyear instagram, Tonsilith cause infection, ... Kiowa casino rewards, Children's books about the space race, 841 sword bridge ......
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