@kawaiininja/fetch 1.0.20 → 1.0.21

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.
@@ -19,8 +19,12 @@ export const useFetch = (endpoint, baseOptions = {}) => {
19
19
  // We use a Ref to store the options so they don't trigger the request callback recreation
20
20
  const optionsRef = useRef(baseOptions);
21
21
  useEffect(() => {
22
+ if (debug)
23
+ console.log(`[useFetch] [${endpoint}] 🛠️ baseOptions changed`);
22
24
  optionsRef.current = baseOptions;
23
- }, [baseOptions]);
25
+ }, [baseOptions, endpoint, debug]);
26
+ if (debug)
27
+ console.log(`[useFetch] [${endpoint}] 🔄 Hook Render`);
24
28
  const [state, setState] = useState({
25
29
  data: null,
26
30
  loading: false,
@@ -32,7 +36,11 @@ export const useFetch = (endpoint, baseOptions = {}) => {
32
36
  setState((prev) => {
33
37
  const updates = fn(prev);
34
38
  if (debug) {
35
- console.log(`[useFetch] [${endpoint}] 🔄 State Update:`, updates);
39
+ console.groupCollapsed(`[useFetch] [${endpoint}] 🔄 State Update`);
40
+ console.log("Current State:", prev);
41
+ console.log("Updates:", updates);
42
+ console.trace("Stack Trace");
43
+ console.groupEnd();
36
44
  }
37
45
  return { ...prev, ...updates };
38
46
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kawaiininja/fetch",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "Core fetch utility for Onyx Framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",