@flagify/react 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -3
- package/dist/index.mjs +9 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -80,10 +80,15 @@ var import_react4 = require("react");
|
|
|
80
80
|
var import_react3 = require("react");
|
|
81
81
|
function useFlagifyClient() {
|
|
82
82
|
const ctx = (0, import_react3.useContext)(FlagifyContext);
|
|
83
|
+
const hasWarned = (0, import_react3.useRef)(false);
|
|
83
84
|
if (ctx === NO_PROVIDER) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
if (!hasWarned.current) {
|
|
86
|
+
hasWarned.current = true;
|
|
87
|
+
console.warn(
|
|
88
|
+
"[Flagify] No <FlagifyProvider> found. Hooks will return fallback values. Wrap your app with <FlagifyProvider> to enable feature flags."
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
87
92
|
}
|
|
88
93
|
return ctx.client;
|
|
89
94
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -44,13 +44,18 @@ function FlagifyProvider({ children, ...config }) {
|
|
|
44
44
|
import { useContext as useContext2 } from "react";
|
|
45
45
|
|
|
46
46
|
// src/useFlagifyClient.ts
|
|
47
|
-
import { useContext } from "react";
|
|
47
|
+
import { useContext, useRef as useRef2 } from "react";
|
|
48
48
|
function useFlagifyClient() {
|
|
49
49
|
const ctx = useContext(FlagifyContext);
|
|
50
|
+
const hasWarned = useRef2(false);
|
|
50
51
|
if (ctx === NO_PROVIDER) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
if (!hasWarned.current) {
|
|
53
|
+
hasWarned.current = true;
|
|
54
|
+
console.warn(
|
|
55
|
+
"[Flagify] No <FlagifyProvider> found. Hooks will return fallback values. Wrap your app with <FlagifyProvider> to enable feature flags."
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
54
59
|
}
|
|
55
60
|
return ctx.client;
|
|
56
61
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flagify/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "React SDK for Flagify — hooks and provider for feature flag evaluation.",
|
|
5
5
|
"author": "Mario Campbell R <mario@mariocampbellr.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"react": ">=18.0.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@flagify/node": "1.0.
|
|
24
|
+
"@flagify/node": "1.0.3"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@testing-library/jest-dom": "^6.9.1",
|