@uniformdev/context-react
Advanced tools
Comparing version 19.164.0 to 19.165.0
@@ -47,5 +47,6 @@ 'use client'; | ||
var import_react = require("react"); | ||
function useQuirks() { | ||
const { context } = useUniformContext(); | ||
const [quirks, setQuirks] = (0, import_react.useState)(context.quirks); | ||
function useQuirks(options) { | ||
var _a; | ||
const { context } = useUniformContext(options) || {}; | ||
const [quirks, setQuirks] = (0, import_react.useState)((_a = context == null ? void 0 : context.quirks) != null ? _a : {}); | ||
const quirkChangeListener = (updatedQuirks) => { | ||
@@ -55,5 +56,5 @@ setQuirks(updatedQuirks); | ||
(0, import_react.useEffect)(() => { | ||
context.events.on("quirksUpdated", quirkChangeListener); | ||
context == null ? void 0 : context.events.on("quirksUpdated", quirkChangeListener); | ||
return () => { | ||
context.events.off("quirksUpdated", quirkChangeListener); | ||
context == null ? void 0 : context.events.off("quirksUpdated", quirkChangeListener); | ||
}; | ||
@@ -60,0 +61,0 @@ }, [context]); |
@@ -9,3 +9,3 @@ import { Quirks, ScoreVector, Context, PersonalizedVariant, TestVariant, EnrichmentData } from '@uniformdev/context'; | ||
*/ | ||
declare function useQuirks(): Quirks; | ||
declare function useQuirks(options?: Parameters<typeof useUniformContext>[0]): Quirks; | ||
@@ -12,0 +12,0 @@ /** |
@@ -5,5 +5,6 @@ 'use client'; | ||
import { useEffect, useState } from "react"; | ||
function useQuirks() { | ||
const { context } = useUniformContext(); | ||
const [quirks, setQuirks] = useState(context.quirks); | ||
function useQuirks(options) { | ||
var _a; | ||
const { context } = useUniformContext(options) || {}; | ||
const [quirks, setQuirks] = useState((_a = context == null ? void 0 : context.quirks) != null ? _a : {}); | ||
const quirkChangeListener = (updatedQuirks) => { | ||
@@ -13,5 +14,5 @@ setQuirks(updatedQuirks); | ||
useEffect(() => { | ||
context.events.on("quirksUpdated", quirkChangeListener); | ||
context == null ? void 0 : context.events.on("quirksUpdated", quirkChangeListener); | ||
return () => { | ||
context.events.off("quirksUpdated", quirkChangeListener); | ||
context == null ? void 0 : context.events.off("quirksUpdated", quirkChangeListener); | ||
}; | ||
@@ -18,0 +19,0 @@ }, [context]); |
@@ -47,5 +47,6 @@ 'use client'; | ||
var import_react = require("react"); | ||
function useQuirks() { | ||
const { context } = useUniformContext(); | ||
const [quirks, setQuirks] = (0, import_react.useState)(context.quirks); | ||
function useQuirks(options) { | ||
var _a; | ||
const { context } = useUniformContext(options) || {}; | ||
const [quirks, setQuirks] = (0, import_react.useState)((_a = context == null ? void 0 : context.quirks) != null ? _a : {}); | ||
const quirkChangeListener = (updatedQuirks) => { | ||
@@ -55,5 +56,5 @@ setQuirks(updatedQuirks); | ||
(0, import_react.useEffect)(() => { | ||
context.events.on("quirksUpdated", quirkChangeListener); | ||
context == null ? void 0 : context.events.on("quirksUpdated", quirkChangeListener); | ||
return () => { | ||
context.events.off("quirksUpdated", quirkChangeListener); | ||
context == null ? void 0 : context.events.off("quirksUpdated", quirkChangeListener); | ||
}; | ||
@@ -60,0 +61,0 @@ }, [context]); |
{ | ||
"name": "@uniformdev/context-react", | ||
"version": "19.164.0", | ||
"version": "19.165.0", | ||
"description": "Uniform Context React integration package", | ||
@@ -34,3 +34,3 @@ "license": "SEE LICENSE IN LICENSE.txt", | ||
"dependencies": { | ||
"@uniformdev/context": "19.164.0", | ||
"@uniformdev/context": "19.165.0", | ||
"cookie": "0.6.0", | ||
@@ -49,3 +49,3 @@ "dequal": "2.0.3" | ||
}, | ||
"gitHead": "016e3b85373592ca9beb19593aa120247b638c06" | ||
"gitHead": "edbe5a9fe21137f383003c6f604934dc9501b6e6" | ||
} |
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
109828
2081
20
33
3
300
+ Added@uniformdev/context@19.165.0(transitive)
- Removed@uniformdev/context@19.164.0(transitive)
Updated@uniformdev/context@19.165.0