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

InteractionManager crash when cancelling promise task before it completes #16321

Closed
jfaris opened this issue Oct 11, 2017 · 2 comments
Closed
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. JavaScript Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@jfaris
Copy link

jfaris commented Oct 11, 2017

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

react-native 0.47.2

Steps to Reproduce

  1. Schedule a long-running promise task with InteractionManager.runAfterInteractions
    const promise = InteractionManager.runAfterInteractions({
      gen: () => {
        // do a long fetch and return a promise
      }
    });
  1. After the task has started but before it is done, cancel the task
    promise.cancel()
  1. When the task completes TaskQueue will throw an exception
    TaskQueue: Error resolving Promise in task undefined: undefined is not an object (evaluating '_this2._queueStack[stackIdx].popable = true')

Expected Behavior

No error would be thrown. InteractionManager (TaskQueue) would ignore the completion of a cancelled task and start the next task.

Actual Behavior

Error was thrown from TaskQueue line 158:

iOS: TaskQueue: Error resolving Promise in task undefined: undefined is not an object (evaluating '_this2._queueStack[stackIdx].popable = true')

Android: TaskQueue: Error resolving Promise in task undefined: Attempted to assign to readonly property.

Reproducible Demo

https://snack.expo.io/HJivJZ33-

@janicduplessis janicduplessis added Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. JavaScript labels Oct 13, 2017
@jfaris
Copy link
Author

jfaris commented Nov 7, 2017

@sahrens It looks like you've worked on this code the most. Any thoughts on this issue?

My use case is starting a task in componentDidMount and canceling it in componentWillUnmount. If the cancel comes after the task is started, it throws this error.

@stale
Copy link

stale bot commented Jan 6, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 6, 2018
@stale stale bot closed this as completed Jan 13, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Jan 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. JavaScript Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants