Skip to content

Commit

Permalink
1.0.5 (#35)
Browse files Browse the repository at this point in the history
* feat: QweryProvider (#1)

* feat: useQwery hook (#2)

* feat: useQwery hook

* fix: proxy onChange for when a Promise is not returned, so onSuccess is not triggered

* chore: update readme (#3)

* feat: subscriptions and polling (#4)

* feat: useRememberScroll (#5)

* feat: refetchOnWindowFocus (#6)

* 0.0.1

* fix: awaiting initial value, either or can resolve to nullish (#8)

* types: useQweryOptions (#9)

* types: rough types for useQweryOptions

* fix: with makeMonitoredFetch, if a fetch is not enabled then it returns void so don't initialize the crdt in this case. update useRememberScroll to not execute server side

* chore: add vitest, react testing library, jsdom (#10)

* test: adding test api and redis (#11)

* test: add tests for useQwery, csr and ssr (#12)

* test: add tests for useQwery, csr and ssr

* chore: add gh actions

* 0.0.2

* chore: cleanup and update vite to build as lib (#14)

* chore: remove api.put (#15)

* chore: update deps, update exports, update types (#16)

* fix: effects don't run in ssr (#17)

* fix: effects don't run in ssr so return initialValue if it is an object, up to client to await and use suspense or what not. also update renderSsr to remove window while calling ReactDOMServer

* test: adding tests for async caches

* style: remove unused import

* types: update types

* refactor: update QweryProvider

* style: double quotes

* fix: silence act errors (#18)

* style: remove unused imports (#19)

* 0.0.3

* chore: update readme (#21)

* chore: update readme (#22)

* 1.0.0

* chore: update export locations (#24)

* 1.0.1

* chore: update README (#26)

* 1.0.2

* chore: update readme (#28)

* chore: update exports (#29)

* 1.0.3

* fix: unsubscribe (#31)

* fix: subscription return (#32)

* 1.0.4

* fix: fix build output issues making react and other deps external, update subscribe and onWindowFocus (#34)

* 1.0.5
  • Loading branch information
nmathew98 committed Feb 25, 2024
1 parent d1c88e3 commit 642560c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@b.s/react-qwery",
"version": "1.0.4",
"version": "1.0.5",
"type": "module",
"repository": {
"type": "git",
Expand Down Expand Up @@ -33,7 +33,9 @@
"LICENSE",
"package.json",
"pnpm-lock.yaml",
"README.md"
"README.md",
"tsconfig.json",
"tsconfig.node.json"
],
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src/e2e/use-qwery.csr.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ describe("useQwery csr", () => {
</BrowserProviders>,
);

fireEvent.focusIn(window);
fireEvent.focus(window);

await waitFor(() => {
expect(getInitialValue).toBeCalledTimes(2);
Expand Down
2 changes: 1 addition & 1 deletion src/e2e/use-qwery.ssr.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ describe("useQwery ssr", () => {
</SsrProviders>,
);

fireEvent.focusIn(window);
fireEvent.focus(window);

await waitFor(() => {
expect(getInitialValue).toBeCalledTimes(2);
Expand Down
10 changes: 7 additions & 3 deletions src/use-qwery/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ export const useQwery = <
subscribeOptions,
]);

setRenderCount(renderCount => renderCount + 1);

return result;
},
});
Expand Down Expand Up @@ -141,6 +143,8 @@ export const useQwery = <
refetchOptions,
]);

setRenderCount(renderCount => renderCount + 1);

return result;
},
});
Expand All @@ -149,11 +153,11 @@ export const useQwery = <
};

if (refetchOnWindowFocus) {
window.addEventListener("focusin", onWindowFocus);
window.addEventListener("focus", onWindowFocus);
}

return () => {
window.removeEventListener("focusin", onWindowFocus);
window.removeEventListener("focus", onWindowFocus);
unsubscribe();
};
}, []);
Expand All @@ -178,7 +182,7 @@ export const useQwery = <
return {
data: crdtRef.current?.data ?? computeInitialValue(),
dispatch: crdtRef.current?.dispatch ?? noOpFunction,
versions: crdtRef.current?.versions ?? [],
versions: crdtRef.current?.versions,
};
};

Expand Down
15 changes: 15 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ export default defineConfig({
entry: resolve("src", "index.ts"),
name: "React Qwery",
},
minify: false,
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: ["react", "@b.s/incremental", "@b.s/txn"],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
react: "React",
"@b.s/incremental": "incremental",
"@b.s/txn": "txn",
},
},
},
emptyOutDir: true,
},
});

0 comments on commit 642560c

Please sign in to comment.