@soundxyz/graphql-react-ws
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -28,3 +28,3 @@ import { ClientOptions, ExecutionResult } from 'graphql-ws'; | ||
} | null; | ||
useSubscription: <Doc_1 extends StringDocumentNode<Record<string, any>, Record<string, any>>>({ query, onData, onError, variables, initialData, }: { | ||
useSubscription: <Doc_1 extends StringDocumentNode<Record<string, any>, Record<string, any>>>({ query, onData, onError, variables, initialData, enabled, }: { | ||
query: Doc_1; | ||
@@ -34,2 +34,3 @@ onData?: OnData<Doc_1> | undefined; | ||
initialData?: ExecutionResultWithData<ResultOf<Doc_1>> | null | undefined; | ||
enabled?: boolean | undefined; | ||
} & (VariablesOf<Doc_1> extends Record<string, never> ? { | ||
@@ -36,0 +37,0 @@ variables?: undefined; |
@@ -149,3 +149,4 @@ import { createClient } from 'graphql-ws'; | ||
variables, | ||
initialData = null | ||
initialData = null, | ||
enabled = true | ||
}) { | ||
@@ -183,3 +184,3 @@ const store = getSubscriptionStore({ | ||
const subscription = useMemo(() => { | ||
if (typeof window === "undefined" || stableVariables === false) | ||
if (typeof window === "undefined" || stableVariables === false || enabled === false) | ||
return null; | ||
@@ -190,3 +191,3 @@ return subscribe( | ||
// Can't verify the conditional types around optional variables | ||
variables | ||
variables: stableVariables | ||
}, | ||
@@ -221,3 +222,3 @@ async function({ iterator }) { | ||
); | ||
}, []); | ||
}, [stableVariables, enabled, query]); | ||
useEffect(() => { | ||
@@ -224,0 +225,0 @@ if (!subscription) |
{ | ||
"name": "@soundxyz/graphql-react-ws", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"sideEffects": false, | ||
@@ -5,0 +5,0 @@ "peerDependencies": { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12990
370
0