Skip to content

solid-query-persist-client: init at 4.13.0#4380

Closed
milahu wants to merge 36 commits intoTanStack:mainfrom
milahu:solid-query-persist-client--init
Closed

solid-query-persist-client: init at 4.13.0#4380
milahu wants to merge 36 commits intoTanStack:mainfrom
milahu:solid-query-persist-client--init

Conversation

@milahu
Copy link

@milahu milahu commented Oct 25, 2022

add persistent caching for solid-query

based on

todo

fix tests?

example: remove workspace:* deps

done

make it build: packages/solid-query-persist-client/build/ is not generated
→ add buildConfigs block to rollup.config.ts

fix example: transitive dependencies are not installed by pnpm
vite: ✘ [ERROR] Could not resolve "@mswjs/cookies"
dependency graph: @tanstack/query-example-solid-offline → msw → @mswjs/cookies
solved by removing { resolve: { preserveSymlinks: true } } from vite.config.ts

fixme: solid build is not produced
packages/solid-query-persist-client/build/solid/
but is declared in tsconfig.json
fixme: solid jsx is compiled to React.createElement
packages/solid-query-persist-client/src/PersistQueryClientProvider.tsx
solved by adding
{ "path": "packages/solid-query-persist-client" },
to the root tsconfig.json

fixme: service worker in typescript is not compiled to javascript?
A bad HTTP response code (404) was received when fetching the script.
fixed by running npx msw init . to generate mockServiceWorker.js (docs)

fixme: double fetching

rest-deps.js:82 [MSW] 21:58:24 GET /movies (200 OK)
rest-deps.js:82 [MSW] 21:58:24 GET /movies (200 OK)

fixed by query options { refetchOnMount: false }

i use unwrap to remove solidjs Proxy objects from queryKey
before storing the query cache in indexeddb.
is this a lossy transformation?
or is it okay to restore the query cache without solidjs Proxy objects
→ okay because we use handleResult(observer.getCurrentResult())
which calls setState(unwrap(unwrappedResult))
which restores the solidjs Proxy objects

fix examples/solid/offline

createQueries: add persistence

createMutation: add persistence
no. useIsRestoring is used only in
packages/react-query/src/useBaseQuery.ts
packages/react-query/src/useQueries.ts

ping

@lukesmurray

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 25, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 2ce3b6c:

Sandbox Source
@tanstack/query-example-react-basic-typescript Configuration
@tanstack/query-example-solid-basic-typescript Configuration
@tanstack/query-example-vue-basic Configuration

Copy link
Collaborator

@TkDodo TkDodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
I think one thing that's missing is that createQueries would also need to listen to isRestoring - at least that's what we also have in react!

@milahu
Copy link
Author

milahu commented Oct 28, 2022

currently blocked by

fixme: solid build is not produced
packages/solid-query-persist-client/build/solid/
but is declared in tsconfig.json

fixme: solid jsx is compiled to React.createElement
packages/solid-query-persist-client/src/PersistQueryClientProvider.tsx

no idea whats wrong ...
should be compiled for solid, but is compiled for react

@ardeora
Copy link
Contributor

ardeora commented Oct 28, 2022

Hello @milahu! Thanks for working on the persister! This is looking very promising. One thing I noticed that is preventing the solid folder to be generated is because you need to add another reference in the root tsconfig.

{ "path": "packages/solid-query-persist-client" },

Once you add that running pnpm run build should create the correct source build for the persist client

@milahu milahu force-pushed the solid-query-persist-client--init branch from c51e306 to cb44541 Compare October 28, 2022 19:59
@milahu

This comment was marked as spam.

@milahu milahu force-pushed the solid-query-persist-client--init branch from 6305052 to 2ce3b6c Compare October 30, 2022 10:09
@ardeora
Copy link
Contributor

ardeora commented Oct 22, 2023

Closing this in favor of #5858

@ardeora ardeora closed this Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants