@tamagui/use-force-update 1.0.1-beta.140 → 1.0.1-beta.141

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
@@ -23,6 +23,10 @@ __export(src_exports, {
23
23
  module.exports = __toCommonJS(src_exports);
24
24
  var import_react = require("react");
25
25
  function useForceUpdate() {
26
+ if (typeof document === "undefined") {
27
+ return () => {
28
+ };
29
+ }
26
30
  return (0, import_react.useReducer)((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1];
27
31
  }
28
32
  // Annotate the CommonJS export names for ESM import in node:
@@ -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 return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1]\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAEpB,0BAA0B;AAC/B,SAAO,6BAAW,CAAC,MAAO,KAAI,KAAK,OAAO,kBAAkB,CAAC,EAAE;AACjE;",
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;",
6
6
  "names": []
7
7
  }
package/dist/esm/index.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { useReducer } from "react";
2
2
  function useForceUpdate() {
3
+ if (typeof document === "undefined") {
4
+ return () => {
5
+ };
6
+ }
3
7
  return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1];
4
8
  }
5
9
  export {
@@ -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 return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1]\n}\n"],
5
- "mappings": "AAAA;AAEO,0BAA0B;AAC/B,SAAO,WAAW,CAAC,MAAO,KAAI,KAAK,OAAO,kBAAkB,CAAC,EAAE;AACjE;",
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;",
6
6
  "names": []
7
7
  }
package/dist/jsx/index.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { useReducer } from "react";
2
2
  function useForceUpdate() {
3
+ if (typeof document === "undefined") {
4
+ return () => {
5
+ };
6
+ }
3
7
  return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1];
4
8
  }
5
9
  export {
@@ -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 return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1]\n}\n"],
5
- "mappings": "AAAA;AAEO,0BAA0B;AAC/B,SAAO,WAAW,CAAC,MAAO,KAAI,KAAK,OAAO,kBAAkB,CAAC,EAAE;AACjE;",
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;",
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.140",
3
+ "version": "1.0.1-beta.141",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -19,7 +19,7 @@
19
19
  "clean:build": "tamagui-build clean:build"
20
20
  },
21
21
  "devDependencies": {
22
- "@tamagui/build": "^1.0.1-beta.140",
22
+ "@tamagui/build": "^1.0.1-beta.141",
23
23
  "react": "*"
24
24
  },
25
25
  "peerDependencies": {
package/src/index.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  import { useReducer } from 'react'
2
2
 
3
3
  export function useForceUpdate() {
4
+ // RSC
5
+ if (typeof document === 'undefined') {
6
+ return () => {}
7
+ }
4
8
  return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1]
5
9
  }
package/types/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
- export declare function useForceUpdate(): import("react").DispatchWithoutAction;
1
+ export declare function useForceUpdate(): () => void;
3
2
  //# sourceMappingURL=index.d.ts.map