Skip to content

usePromiseTracker - simultaneous multiple calls  #90

@ssukienn

Description

@ssukienn

I have a question. Should usePromiseTracker hook work with simultaneous calls from different places?

I have a scenario where I have Loader component to which I can pass area etc. and render something after promise resolves. But until now, call to the same area hook was happening only from loader component itself. Now I would like to use this hook inside some other component (it is HOC) to check if specific promise is finished (apart from Loader).

So in fact I call the hook in the same time from different places:

  1. In Loader
  2. In HOC (which in fact is nested under the Loader component, so calls from Loader happens first)

What I observe is that second hook (in HOC) is always returning inProgress as false no matter what. The hook in loader works fine. The component is not rendered until promise resolves but the hoc logic and hooks execution still happens.

Is it something on my end and it is suppossed to work like that or there might be some implementation details of the hook itself which prevent this scenario?

Unfortunately to use case is too complicated to easily reproduce it so for now I am just asking. Right now I am workarounding this with putting tracking info in state store, but would rather avoid it and thought it will work in the first place.

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