Skip to content
This repository was archived by the owner on Sep 8, 2021. It is now read-only.
This repository was archived by the owner on Sep 8, 2021. It is now read-only.

Editor component possible race condition #5

@nvartolomei

Description

@nvartolomei

I was wondering if there could be a race condition.

Suppose I try to edit an article, Editor component si being mounted and EDITOR_PAGE_LOADED event is dispatched.

The request is sent to server, but the server didn't respond yet. (1)

Now I go back to homepage, editor component is unmounted, EDITOR_PAGE_UNLOADED is dispatched, the state related to editor component is cleared.

Now I try to edit another article, Editor component is mounted, EDITOR_PAGE_LOADED is dispatched for another article.

The request is sent to server, and server responds instantly. (2)

Reducer for EDITOR_PAGE_LOADED action triggered by second request is called. Everything cool still.

Now, the first request (1) is full-filled, and reducer for EDITOR_PAGE_LOADED action is called, with information from first request, and in the editor I will see the contents for first article I tried to edit, instead of the second one.

Hm?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions