Skip to content

Promise polyfill on core-js 3 breaks Vue nextTick (using microtasks) on Tizen 2016 #814

@victortwc

Description

@victortwc

Hello!

It's a super weird edge case that works fine on core-js@2 but breaks on core-js@3. While investigating, I could narrow down to the promise polyfill, by including every polyfill from core-js@3 except Promise, which I included core-js@2 instead, the app works fine.

My use case is described in this issue:
vuejs/vue-cli#5386

TV User agent:
"Mozilla/5.0 (SMART-TV; Linux; Tizen 2.4.0) AppleWebKit/538.1 (KHTML, like Gecko) Version/2.4.0 TV Safari/538.1"

Vue nextTick implementation:
https://github.com/vuejs/vue/blob/dev/src/core/util/next-tick.js#L13

Even though this function is tied to this:

const p = Promise.resolve()
  
timerFunc = () => {
    p.then(flushCallbacks)
    if (isIOS) setTimeout(noop)
}

it will only get executed if another task is queued, like a setTimeout. If I wrap my events in a setTimeout it works again, but it looks like a dirty hack.

Are there any fundamental differences between the v2 and v3 Promise/microtask polyfills? Hope this helps to solve the mystery.

I'm also thinking of sending a PR to Vue to add if (isIOS || isTizen) to that condition, but if it can be solved on the core-js level probably more people would benefit.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions