@graphitation/apollo-react-relay-duct-tape
Advanced tools
Comparing version 0.4.3 to 0.5.0-store-observation.1
# Change Log - @graphitation/apollo-react-relay-duct-tape | ||
This log was last generated on Mon, 04 Oct 2021 13:47:53 GMT and should not be manually modified. | ||
This log was last generated on Tue, 05 Oct 2021 08:17:39 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## 0.5.0-store-observation.1 | ||
Tue, 05 Oct 2021 08:17:39 GMT | ||
### Changes | ||
- Introduces ability to narrow down store observation to fragment level (eloy.de.enige@gmail.com) | ||
## 0.4.3 | ||
Mon, 04 Oct 2021 13:47:53 GMT | ||
Mon, 04 Oct 2021 13:48:04 GMT | ||
@@ -11,0 +19,0 @@ ### Patches |
@@ -130,59 +130,3 @@ import { DocumentNode } from "graphql"; | ||
export declare function useSubscription<TSubscriptionPayload extends OperationType>(config: GraphQLSubscriptionConfig<TSubscriptionPayload>): void; | ||
interface IMutationCommitterOptions<TMutationPayload extends OperationType> { | ||
variables: TMutationPayload["variables"]; | ||
optimisticResponse?: Partial<TMutationPayload["response"]> | null; | ||
} | ||
declare type MutationCommiter<TMutationPayload extends OperationType> = (options: IMutationCommitterOptions<TMutationPayload>) => Promise<{ | ||
errors?: Error[]; | ||
data?: TMutationPayload["response"]; | ||
}>; | ||
/** | ||
* Declare use of a mutation within component. Returns an array of a function and loading state boolean. | ||
* | ||
* Returned function can be called to perform the actual mutation with provided variables. | ||
* | ||
* @param mutation Mutation document | ||
* @returns [commitMutationFn, isInFlight] | ||
* | ||
* commitMutationFn | ||
* @param options.variables map of variables to pass to mutation | ||
* @param options.optimisticResponse proposed response to apply to the store while mutation is in flight | ||
* @returns A Promise to an object with either errors or/and the result data | ||
* | ||
* Example | ||
``` | ||
const mutation = graphql` | ||
mutation SomeReactComponentMutation($newName: String!) { | ||
someMutation(newName: $newName) { | ||
__typeName | ||
id | ||
newName | ||
} | ||
} | ||
` | ||
export const SomeReactComponent: React.FunctionComponent<SomeReactComponentProps> = props => { | ||
const [commitMutation, isInFlight] = useMutation(mutation); | ||
return ( | ||
<div> | ||
<button onClick={() => commitMutation({ | ||
variables: { | ||
newName: "foo" | ||
}, | ||
optimisticResponse: { | ||
someMutation: { | ||
__typename: "SomeMutationPayload", | ||
id: "1", | ||
newName: "foo", | ||
} | ||
} | ||
})} disabled={isInFlight}/> | ||
</div> | ||
); | ||
} | ||
``` | ||
*/ | ||
export declare function useMutation<TMutationPayload extends OperationType>(mutation: GraphQLTaggedNode): [MutationCommiter<TMutationPayload>, boolean]; | ||
export {}; | ||
//# sourceMappingURL=hooks.d.ts.map |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.4.3", | ||
"version": "0.5.0-store-observation.1", | ||
"main": "./lib/index", | ||
@@ -17,3 +17,3 @@ "scripts": { | ||
"devDependencies": { | ||
"@apollo/client": "^3.3.15", | ||
"@apollo/client": "^3.4.13", | ||
"@graphitation/apollo-mock-client": "^0.6.9", | ||
@@ -27,6 +27,7 @@ "@graphitation/graphql-js-operation-payload-generator": "^0.5.9", | ||
"relay-compiler": "^11.0.2", | ||
"relay-compiler-language-graphitation": "^0.5.1", | ||
"relay-compiler-language-graphitation": "^0.6.0-store-observation.1", | ||
"ts-expect": "^1.3.0" | ||
}, | ||
"peerDependencies": { | ||
"@apollo/client": "^3.4.13", | ||
"graphql": "^15.5.0", | ||
@@ -33,0 +34,0 @@ "react": "^17.0.2" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25063
4
16
387