Skip to content

feat(axios): support persistBy 'fresh' to replace store data#2035

Merged
CodeDredd merged 1 commit into
mainfrom
feat/axios-persist-by-fresh
Jul 20, 2026
Merged

feat(axios): support persistBy 'fresh' to replace store data#2035
CodeDredd merged 1 commit into
mainfrom
feat/axios-persist-by-fresh

Conversation

@CodeDredd

Copy link
Copy Markdown
Owner

Feature (#1885)

persistBy now additionally accepts 'fresh', which persists the response through the repository's fresh() method — the response replaces all existing records of the entity, so records deleted on the server disappear from the store too:

useAxiosRepo(User).api().get('/api/users', { persistBy: 'fresh' })

Works per request, per model config, or globally in createPiniaOrmAxios() like every other plugin option. Docs updated (configuration page).

Tests

2 new tests: fresh removes stale records / keeps response records, insert still merges. Axios suite green (25 tests).

closes #1885

The response of an api call can now replace all existing records of the
entity by setting persistBy to 'fresh', making the api response the
single source of truth.

closes #1885
@codecov-commenter

codecov-commenter commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.47%. Comparing base (c6bebb9) to head (7f2584f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2035      +/-   ##
==========================================
+ Coverage   99.40%   99.47%   +0.06%     
==========================================
  Files          82       82              
  Lines        3025     3025              
  Branches      533      533              
==========================================
+ Hits         3007     3009       +2     
+ Misses         15       13       -2     
  Partials        3        3              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@CodeDredd
CodeDredd merged commit 5b5f6b7 into main Jul 20, 2026
12 of 13 checks passed
@CodeDredd
CodeDredd deleted the feat/axios-persist-by-fresh branch July 20, 2026 15:06
@github-actions github-actions Bot mentioned this pull request Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can we have something similar to fresh() for the axios plugin?

2 participants