Skip to content

Feature/persist error handling - #3556

Merged
TkDodo merged 14 commits into
TanStack:betafrom
TkDodo:feature/persist-error-handling
May 21, 2022
Merged

TkDodo merged 14 commits into
TanStack:betafrom
TkDodo:feature/persist-error-handling

Conversation

@TkDodo

@TkDodo TkDodo commented Apr 24, 2022 •

Copy link
Copy Markdown
Collaborator

closes #3034

@vercel

vercel Bot commented Apr 24, 2022 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
react-query ✅ Ready (Inspect) Visit Preview May 21, 2022 at 9:26AM (UTC)

@codesandbox-ci

codesandbox-ci Bot commented Apr 24, 2022 •

Copy link
Copy Markdown

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 4980f5b:

Sandbox Source
tannerlinsley/react-query: basic Configuration
tannerlinsley/react-query: basic-typescript Configuration

@codecov

codecov Bot commented Apr 24, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #3556 (4980f5b) into beta (1909cb9) will increase coverage by 0.17%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             beta    #3556      +/-   ##
==========================================
+ Coverage   96.93%   97.10%   +0.17%     
==========================================
  Files          48       49       +1     
  Lines        2383     2387       +4     
  Branches      709      709              
==========================================
+ Hits         2310     2318       +8     
+ Misses         71       67       -4     
  Partials        2        2              
Impacted Files Coverage Δ
src/persistQueryClient/persist.ts 95.45% <ø> (ø)
src/createWebStoragePersister/index.ts 86.48% <100.00%> (+6.94%) ⬆️
src/persistQueryClient/retryStrategies.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1909cb9...4980f5b. Read the comment docs.

…t-error-handling

# Conflicts:
#	src/createWebStoragePersister/tests/storageIsFull.test.ts
if null is returned, which is also the default strategy, the webstorage entry will be removed completely.
@TkDodo
TkDodo marked this pull request as ready for review May 15, 2022 07:20
to make sync and async compatible, persist version must also throw an error to abort
@TkDodo
TkDodo merged commit 34afdde into TanStack:beta May 21, 2022
@TkDodo
TkDodo deleted the feature/persist-error-handling branch May 21, 2022 09:33
@tannerlinsley

Copy link
Copy Markdown
Member

🎉 This PR is included in version 4.0.0-beta.13 🎉

The release is available on:

Your semantic-release bot 📦🚀

m8951406 pushed a commit to mustafakmelli/query that referenced this pull request Feb 17, 2026
* refactor: remove type-fest as a dependency

only used for the Promisable type, which is easy to recreate

* feat(persistQueryClient): error handling strategies for persist plugins

* feat(persistQueryClient): error handling strategies for persist plugins

adapt tests

* make handlePersistError return null to stop retries

if null is returned, which is also the default strategy, the webstorage entry will be removed completely.

* test for default behaviour

* async version for persist error handling

to make sync and async compatible, persist version must also throw an error to abort

* make sure that async persister can accept sync error handlers

* undefined errorStrategy, or return undefined from it, will just not persist anymore

* rename to retry + documentation

* improve docs

This branch was successfully deployed

1 active deployment
Preview — 4980f5b3 Deployed May 21, 2022 by vercel[bot]
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.

2 participants