@tamagui/use-force-update 1.0.1-beta.147 → 1.0.1-beta.148

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/cjs/index.js CHANGED
@@ -18,19 +18,22 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var src_exports = {};
20
20
  __export(src_exports, {
21
+ isServerSide: () => isServerSide,
21
22
  useForceUpdate: () => useForceUpdate
22
23
  });
23
24
  module.exports = __toCommonJS(src_exports);
24
25
  var import_react = require("react");
26
+ const isServerSide = process.env.TAMAGUI_TARGET === "web" && typeof window === "undefined";
25
27
  function useForceUpdate() {
26
- if (typeof document === "undefined") {
28
+ if (isServerSide) {
27
29
  return () => {
28
30
  };
29
31
  }
30
- return (0, import_react.useReducer)((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1];
32
+ return (0, import_react.useReducer)((x) => x + 1, 0)[1];
31
33
  }
32
34
  // Annotate the CommonJS export names for ESM import in node:
33
35
  0 && (module.exports = {
36
+ isServerSide,
34
37
  useForceUpdate
35
38
  });
36
39
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["import { useReducer } from 'react'\n\nexport function useForceUpdate() {\n // RSC\n if (typeof document === 'undefined') {\n return () => {}\n }\n return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1]\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAEpB,0BAA0B;AAE/B,MAAI,OAAO,aAAa,aAAa;AACnC,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AACA,SAAO,6BAAW,CAAC,MAAO,KAAI,KAAK,OAAO,kBAAkB,CAAC,EAAE;AACjE;",
4
+ "sourcesContent": ["import { useReducer } from 'react'\n\nexport const isServerSide = process.env.TAMAGUI_TARGET === 'web' && typeof window === 'undefined'\n\nexport function useForceUpdate() {\n if (isServerSide) {\n return () => {}\n }\n return useReducer((x) => x + 1, 0)[1] as () => void\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAEpB,MAAM,eAAe,QAAQ,IAAI,mBAAmB,SAAS,OAAO,WAAW;AAE/E,0BAA0B;AAC/B,MAAI,cAAc;AAChB,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AACA,SAAO,6BAAW,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE;AACrC;",
6
6
  "names": []
7
7
  }
package/dist/esm/index.js CHANGED
@@ -1,12 +1,14 @@
1
1
  import { useReducer } from "react";
2
+ const isServerSide = process.env.TAMAGUI_TARGET === "web" && typeof window === "undefined";
2
3
  function useForceUpdate() {
3
- if (typeof document === "undefined") {
4
+ if (isServerSide) {
4
5
  return () => {
5
6
  };
6
7
  }
7
- return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1];
8
+ return useReducer((x) => x + 1, 0)[1];
8
9
  }
9
10
  export {
11
+ isServerSide,
10
12
  useForceUpdate
11
13
  };
12
14
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["import { useReducer } from 'react'\n\nexport function useForceUpdate() {\n // RSC\n if (typeof document === 'undefined') {\n return () => {}\n }\n return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1]\n}\n"],
5
- "mappings": "AAAA;AAEO,0BAA0B;AAE/B,MAAI,OAAO,aAAa,aAAa;AACnC,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AACA,SAAO,WAAW,CAAC,MAAO,KAAI,KAAK,OAAO,kBAAkB,CAAC,EAAE;AACjE;",
4
+ "sourcesContent": ["import { useReducer } from 'react'\n\nexport const isServerSide = process.env.TAMAGUI_TARGET === 'web' && typeof window === 'undefined'\n\nexport function useForceUpdate() {\n if (isServerSide) {\n return () => {}\n }\n return useReducer((x) => x + 1, 0)[1] as () => void\n}\n"],
5
+ "mappings": "AAAA;AAEO,MAAM,eAAe,QAAQ,IAAI,mBAAmB,SAAS,OAAO,WAAW;AAE/E,0BAA0B;AAC/B,MAAI,cAAc;AAChB,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AACA,SAAO,WAAW,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE;AACrC;",
6
6
  "names": []
7
7
  }
package/dist/jsx/index.js CHANGED
@@ -1,12 +1,14 @@
1
1
  import { useReducer } from "react";
2
+ const isServerSide = process.env.TAMAGUI_TARGET === "web" && typeof window === "undefined";
2
3
  function useForceUpdate() {
3
- if (typeof document === "undefined") {
4
+ if (isServerSide) {
4
5
  return () => {
5
6
  };
6
7
  }
7
- return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1];
8
+ return useReducer((x) => x + 1, 0)[1];
8
9
  }
9
10
  export {
11
+ isServerSide,
10
12
  useForceUpdate
11
13
  };
12
14
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["import { useReducer } from 'react'\n\nexport function useForceUpdate() {\n // RSC\n if (typeof document === 'undefined') {\n return () => {}\n }\n return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1]\n}\n"],
5
- "mappings": "AAAA;AAEO,0BAA0B;AAE/B,MAAI,OAAO,aAAa,aAAa;AACnC,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AACA,SAAO,WAAW,CAAC,MAAO,KAAI,KAAK,OAAO,kBAAkB,CAAC,EAAE;AACjE;",
4
+ "sourcesContent": ["import { useReducer } from 'react'\n\nexport const isServerSide = process.env.TAMAGUI_TARGET === 'web' && typeof window === 'undefined'\n\nexport function useForceUpdate() {\n if (isServerSide) {\n return () => {}\n }\n return useReducer((x) => x + 1, 0)[1] as () => void\n}\n"],
5
+ "mappings": "AAAA;AAEO,MAAM,eAAe,QAAQ,IAAI,mBAAmB,SAAS,OAAO,WAAW;AAE/E,0BAA0B;AAC/B,MAAI,cAAc;AAChB,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AACA,SAAO,WAAW,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE;AACrC;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/use-force-update",
3
- "version": "1.0.1-beta.147",
3
+ "version": "1.0.1-beta.148",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -26,7 +26,7 @@
26
26
  }
27
27
  },
28
28
  "devDependencies": {
29
- "@tamagui/build": "^1.0.1-beta.147",
29
+ "@tamagui/build": "^1.0.1-beta.148",
30
30
  "react": "*"
31
31
  },
32
32
  "peerDependencies": {
package/src/index.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { useReducer } from 'react'
2
2
 
3
+ export const isServerSide = process.env.TAMAGUI_TARGET === 'web' && typeof window === 'undefined'
4
+
3
5
  export function useForceUpdate() {
4
- // RSC
5
- if (typeof document === 'undefined') {
6
+ if (isServerSide) {
6
7
  return () => {}
7
8
  }
8
- return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1]
9
+ return useReducer((x) => x + 1, 0)[1] as () => void
9
10
  }
package/types/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export declare const isServerSide: boolean;
1
2
  export declare function useForceUpdate(): () => void;
2
3
  //# sourceMappingURL=index.d.ts.map