···11+---
22+'@urql/core': patch
33+---
44+55+Allow `makeOperation` to be called with a partial `OperationContext` when it’s called to copy an operation. When it receives an `Operation` as a second argument now, the third argument, the context, will be spread into the prior `operation.context`.
···99/** Creates a {@link Operation} from the given parameters.
1010 *
1111 * @param kind - The {@link OperationType} of GraphQL operation, i.e. `query`, `mutation`, or `subscription`.
1212- * @param request - The {@link GraphQLRequest} used as a template for the `Operation`.
1212+ * @param request - The {@link GraphQLRequest} or {@link Operation} used as a template for the new `Operation`.
1313 * @param context - The {@link OperationContext} `context` data for the `Operation`.
1414- * @returns An {@link Operation}.
1414+ * @returns A new {@link Operation}.
1515 *
1616 * @remarks
1717 * This method is both used to create new {@link Operation | Operations} as well as copy and modify existing
1818 * operations. While it’s not required to use this function to copy an `Operation`, it is recommended, in case
1919 * additional dynamic logic is added to them in the future.
2020 *
2121+ * Hint: When an {@link Operation} is passed to the `request` argument, the `context` argument does not have to be
2222+ * a complete {@link OperationContext} and will instead be combined with passed {@link Operation.context}.
2323+ *
2124 * @example
2225 * An example of copying an existing `Operation` to modify its `context`:
2326 *
···2528 * makeOperation(
2629 * operation.kind,
2730 * operation,
2828- * { ...operation.context, requestPolicy: 'cache-first' },
3131+ * { requestPolicy: 'cache-first' },
2932 * );
3033 * ```
3134 */
···4447>(
4548 kind: OperationType,
4649 request: Operation<Data, Variables>,
4747- context?: OperationContext
5050+ context?: Partial<OperationContext>
4851): Operation<Data, Variables>;
49525053function makeOperation(kind, request, context) {
5151- if (!context) context = request.context;
5254 return {
5355 ...request,
5456 kind,
5555- context,
5757+ context: request.context
5858+ ? {
5959+ ...request.context,
6060+ ...context,
6161+ }
6262+ : context || request.context,
5663 };
5764}
5865···6673 meta: OperationContext['meta']
6774) => {
6875 return makeOperation(operation.kind, operation, {
6969- ...operation.context,
7076 meta: {
7177 ...operation.context.meta,
7278 ...meta,