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

activePostFlushCbs is null #1947

Closed
ybom77 opened this issue Aug 24, 2020 · 4 comments
Closed

activePostFlushCbs is null #1947

ybom77 opened this issue Aug 24, 2020 · 4 comments

Comments

@ybom77
Copy link

ybom77 commented Aug 24, 2020

Version

3.0.0-rc.7

Reproduction link

https://jsfiddle.net/ybom77/u243peaf/1/

Steps to reproduce

What is expected?

there should be no error in console

What is actually happening?

console:Uncaught TypeError: Cannot read property 'length' of null

what I find the reason for this error is the activePostFlushCbs is null

@peng
Copy link

peng commented Aug 24, 2020

I think you write a wrong way.

@HcySunYang
Copy link
Member

HcySunYang commented Aug 24, 2020

I tracked the issue and this test case can reproduce it:

  test('flushPostFlushCbs', async () => {
    let count = 0
    const mounted1 = () => {
      renderJob(mounted2)
    }
    const mounted2 = () => {
      count++
    }
    const renderJob = (hook: Function) => {
      queuePostFlushCb(hook)
      flushPostFlushCbs()
    }

    renderJob(mounted1)
    await nextTick()
    expect(count).toBe(1)
  })

I’m not sure if this is a valid use case, if it’s valid, maybe we shouldn’t just set the value of activePostFlushCbs to null: https://github.com/vuejs/vue-next/blob/master/packages/runtime-core/src/scheduler.ts#L172

@zhigui
Copy link

zhigui commented Aug 24, 2020

Face the same problem. Some use cases like Tiptap.
image
🤔 related issue: #1595 (comment)

@yyx990803
Copy link
Member

Note 53ed991 is a partial commit (I forgot to save the file when committing)

Proper fix commit is 36fa42a

@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants