Skip to content

Maximum call stack size exceeded on subscriptions #313

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

Closed
GauBen opened this issue Jun 28, 2022 · 2 comments
Closed

Maximum call stack size exceeded on subscriptions #313

GauBen opened this issue Jun 28, 2022 · 2 comments

Comments

@GauBen
Copy link
Contributor

GauBen commented Jun 28, 2022

Subscriptions throw

RangeError
Maximum call stack size exceeded
export const SubscriptionThunder = (fn) => (operation, graphqlOptions) => (o, ops) => {
    const returnedFunction = fn(Zeus(operation, o, {
        operationOptions: ops,
        scalars: graphqlOptions?.scalars,
    }));
    if (returnedFunction?.on) {
        returnedFunction.on = (fnToCall) => returnedFunction.on((data) => {
        // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Self-calling function
            if (graphqlOptions?.scalars) {
                return fnToCall(decodeScalarsInResponse({
                    response: data,
                    initialOp: operation,
                    initialZeusQuery: o,
                    returns: ReturnTypes,
                    scalars: graphqlOptions.scalars,
                    ops: Ops,
                }));
            }
            return fnToCall(data);
        });
    }
    return returnedFunction;
};
GauBen added a commit to GauBen/graphql-zeus that referenced this issue Jun 28, 2022
@GauBen
Copy link
Contributor Author

GauBen commented Jun 28, 2022

I've added the fix to #301

GauBen added a commit to GauBen/graphql-zeus that referenced this issue Jul 4, 2022
GauBen added a commit to GauBen/graphql-zeus that referenced this issue Jul 7, 2022
@GauBen
Copy link
Contributor Author

GauBen commented Jul 11, 2022

Fixed by #301

@GauBen GauBen closed this as completed Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant