Skip to content

Commit d7ef0e0

Browse files
committed
fix(data-hooks): ensure intervalRef is initialized as undefined
1 parent 3c4a33f commit d7ef0e0

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

examples/app-react-crud/mocks/node-polyfills.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ export const promises = {
2929
rm: async () => {},
3030
};
3131

32+
// os polyfills
33+
export const type = () => 'Browser';
34+
export const platform = () => 'browser';
35+
export const release = () => '1.0.0';
36+
export const tmpdir = () => '/tmp';
37+
export const homedir = () => '/';
38+
export const endianness = () => 'LE';
39+
export const arch = () => 'javascript';
40+
export const EOL = '\n';
41+
3242
export const readFileSync = () => '';
3343
export const writeFileSync = () => {};
3444
export const statSync = () => ({ isDirectory: () => false, isFile: () => false, isSymbolicLink: () => false });
@@ -45,20 +55,25 @@ export const relative = () => '';
4555
export const posix = {};
4656
export const win32 = {};
4757

58+
// fs/promises and other missing exports
59+
export const open = async () => ({ close: async () => {} });
60+
export const watchFile = () => {};
61+
export const unwatchFile = () => {};
62+
4863
export const fileURLToPath = () => '';
4964
export const pathToFileURL = () => '';
5065

5166
export const readdir = () => {};
5267
export const readdirSync = () => [];
5368
export const readlink = () => {};
5469
export const readlinkSync = () => '';
55-
export const realpath = () => {};
70+
export const realpath = async () => '';
5671
export const realpathSync = () => '';
5772
realpathSync.native = () => '';
5873

5974
export const constants = {};
60-
export const lstat = () => {};
61-
export const stat = () => {};
75+
export const lstat = async () => ({ isDirectory: () => false, isFile: () => false, isSymbolicLink: () => false });
76+
export const stat = async () => ({ isDirectory: () => false, isFile: () => false, isSymbolicLink: () => false });
6277
export const access = () => {};
6378
export const accessSync = () => {};
6479
export const mkdir = () => {};

packages/client-react/src/data-hooks.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export function useQuery<T = any>(
8585
const [isLoading, setIsLoading] = useState(true);
8686
const [isRefetching, setIsRefetching] = useState(false);
8787
const [error, setError] = useState<Error | null>(null);
88-
const intervalRef = useRef<NodeJS.Timeout>();
88+
const intervalRef = useRef<NodeJS.Timeout | undefined>(undefined);
8989

9090
const {
9191
query,

0 commit comments

Comments
 (0)