12

setTimeout(() => {
// some temporary fix, will solve later
}, 0)

...aaaand it stayed there for eternity.

Comments
  • 3
    the temporary and poc solutions are the most permanent ones
  • 3
    just javascript things...
  • 0
    That's just an immediate, aka. microtask-queue flush. The evil version is setTimeout(() => { ... }, 2) known as mtq-flush-flush among my coursemates.
  • 4
    It has to be 2 to distinguish it from a legacy mtq flush which uses a timeout of 1 because some versions of some browsers used to inline timeouts of 0.
  • 1
    Any time you "solve" a problem - regardless of language or environment or whatever else - and as you're writing it, you're thinking: "it's just a weird timing issue", you need to stop right there and REALLY dig deeper. "Little timing things" are almost NEVER little timing things... though many problems APPEAR to be on the surface. This is a lesson I drill into the heads of my team because I've seen it SO many times and seen developers burned by it time and again.
  • 0
    @lorentz that’s freaking hilarious 😂
Add Comment