Skip to content

RTKQ + redux-dynamic-middleware: Maximum call stack size exceeded #2640

@pavandv

Description

@pavandv

This is a duplicate of #1381

Quoting a comment below by @travenec from the mentioned issue, is exactly the problem I'm facing with RTKQ.

Thank you for pointing me in the right direction. That was actually something I wanted to ask originally as well - do I need more middlewares if I use createApi more times (a middleware for each api) or a single set of middlewares is enough? If single (which is then common for all apis), your idea would be even better than any other solutions.

The problem araises when you have multiple api targets (different servers). From what I understand, you cannot really have a createApi targeting https://apiserver.com/api and then just add endpoints targeting other e.g. https://otherserver.com/api. Therefore I don't see that as solution. Feel free to correct my ideas...

We are using Redux store and RTKQ in our Micro Frontends, where a single store is been created in our Base App and child MFE's have their own createAPI pointing to different domains mentioned in the quote and has to inject the respective createAPI's to the Store at our Base APP.

Although we are able to inject the reducers, adding middleware dynamically using redux-dynamic-middlewares is causing Maximum call stack size exceeded error.

How can we inject such Middleware dynamically for given use case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions