We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 55260d4 commit 9cc05f8Copy full SHA for 9cc05f8
packages/tanstack-react-query/src/hooks/useQuery.ts
@@ -102,11 +102,20 @@ function useQueryCore<
102
};
103
104
React.useEffect(() => {
105
- if (!query) return;
+ if (!query) return () => {};
106
107
(async () => {
108
await fetchTables();
109
})();
110
+
111
+ const l = powerSync.registerListener({
112
+ schemaChanged: async () => {
113
+ await fetchTables();
114
+ queryClient.invalidateQueries({ queryKey: options.queryKey });
115
+ }
116
+ });
117
118
+ return () => l?.();
119
}, [powerSync, sqlStatement, stringifiedParams]);
120
121
const queryFn = React.useCallback(async () => {
0 commit comments