@automattic/explat-client-react-helpers
Advanced tools
Comparing version 0.1.0 to 0.1.1
# Changelog | ||
## 0.1.1 | ||
- Remove console.log and bump dependency version | ||
## 0.1.0 | ||
@@ -4,0 +8,0 @@ |
@@ -10,3 +10,2 @@ "use strict"; | ||
const useExperiment = (experimentName, providedOptions = {}) => { | ||
console.log('useExperiment start'); | ||
const options = { | ||
@@ -21,10 +20,6 @@ ...defaultExperimentOptions, | ||
(0, react_1.useEffect)(() => { | ||
console.log('useExperiment useEffect'); | ||
let isSubscribed = true; | ||
if (options.isEligible) { | ||
console.log('useExperiment useEffect loadExperimentAssignment', experimentName); | ||
exPlatClient.loadExperimentAssignment(experimentName).then((v) => { | ||
console.log('useExperiment loadExperimentAssignment promise resolution', v); | ||
exPlatClient.loadExperimentAssignment(experimentName).then(() => { | ||
if (isSubscribed) { | ||
console.log('useExperiment loadExperimentAssignment promise resolution forceUpdate()'); | ||
forceUpdate(); | ||
@@ -44,3 +39,2 @@ } | ||
} | ||
console.log('useExperiment end', options.isEligible); | ||
if (!options.isEligible) { | ||
@@ -50,3 +44,2 @@ return [false, null]; | ||
const maybeExperimentAssignment = exPlatClient.dangerouslyGetMaybeLoadedExperimentAssignment(experimentName); | ||
console.log('useExperiment end', [!maybeExperimentAssignment, maybeExperimentAssignment]); | ||
return [!maybeExperimentAssignment, maybeExperimentAssignment]; | ||
@@ -53,0 +46,0 @@ }; |
@@ -8,3 +8,2 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime"; | ||
const useExperiment = (experimentName, providedOptions = {}) => { | ||
console.log('useExperiment start'); | ||
const options = { | ||
@@ -19,10 +18,6 @@ ...defaultExperimentOptions, | ||
useEffect(() => { | ||
console.log('useExperiment useEffect'); | ||
let isSubscribed = true; | ||
if (options.isEligible) { | ||
console.log('useExperiment useEffect loadExperimentAssignment', experimentName); | ||
exPlatClient.loadExperimentAssignment(experimentName).then((v) => { | ||
console.log('useExperiment loadExperimentAssignment promise resolution', v); | ||
exPlatClient.loadExperimentAssignment(experimentName).then(() => { | ||
if (isSubscribed) { | ||
console.log('useExperiment loadExperimentAssignment promise resolution forceUpdate()'); | ||
forceUpdate(); | ||
@@ -42,3 +37,2 @@ } | ||
} | ||
console.log('useExperiment end', options.isEligible); | ||
if (!options.isEligible) { | ||
@@ -48,3 +42,2 @@ return [false, null]; | ||
const maybeExperimentAssignment = exPlatClient.dangerouslyGetMaybeLoadedExperimentAssignment(experimentName); | ||
console.log('useExperiment end', [!maybeExperimentAssignment, maybeExperimentAssignment]); | ||
return [!maybeExperimentAssignment, maybeExperimentAssignment]; | ||
@@ -51,0 +44,0 @@ }; |
{ | ||
"name": "@automattic/explat-client-react-helpers", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Standalone ExPlat Client: React Helpers.", | ||
@@ -35,3 +35,3 @@ "bugs": "https://github.com/Automattic/wp-calypso/issues", | ||
"@automattic/calypso-typescript-config": "^1.0.0", | ||
"@testing-library/react": "^14.2.1", | ||
"@testing-library/react": "^15.0.7", | ||
"jest": "^29.7.0", | ||
@@ -38,0 +38,0 @@ "react-dom": "^18.2.0", |
@@ -29,4 +29,2 @@ # ExPlat Client: React Helpers | ||
Note: Every component that calls `useExperiment` will return loading as true for at least one render, even if the experiment is already loaded. See pbmo2S-2sV-p2 for more details. | ||
### Type signature | ||
@@ -33,0 +31,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
53067
524
86
1