Skip to content

useContextValuePerExecuteSubscriptionEvent: Spread operator fails to merge objects when contextValue is a class #2397

Open
@abhip167

Description

@abhip167

Issue workflow progress

Describe the bug

onSubscribe({ args, setSubscribeFn }) {
     const executeNew = makeExecute(async executionArgs => {
       const context = await createContext({ args });
       try {
         return await execute({
           ...executionArgs,
           // GraphQL.js 16 changed the type of contextValue to unknown
           // eslint-disable-next-line @typescript-eslint/ban-ts-comment
           // @ts-ignore
           contextValue: { ...executionArgs.contextValue, ...context?.contextPartial },
         });
       } finally {
         context?.onEnd?.();
       }
     });
     setSubscribeFn(subscribe(executeNew));
   },

Expected behavior

  • The object's property should be replaced with a new value, rather than merging the objects using the spread operator.

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