Skip to content

fix(axios): apply global plugin config on first repository use#2028

Merged
CodeDredd merged 1 commit into
mainfrom
fix/axios-global-config-first-use
Jul 19, 2026
Merged

fix(axios): apply global plugin config on first repository use#2028
CodeDredd merged 1 commit into
mainfrom
fix/axios-global-config-first-use

Conversation

@CodeDredd

@CodeDredd CodeDredd commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Bug

AxiosRepository captured config.axiosApi (axios instance + global plugin config) in its constructor — but ORM plugins are registered via registerPlugins() after the repository is constructed. On the first useAxiosRepo() call of an app the repository therefore saw an empty globalApiConfig, and global options like baseURL and dataKey were silently dropped from every request built by that repository (#1987).

The axios instance itself only appeared to work because Request#axios had a fallback to repository.config.axiosApi.axios.

Fix

axios and globalApiConfig are now lazy getters that resolve from this.config.axiosApi — the plugin-merged config the repository receives via setConfig() during plugin registration. setAxios() still overrides the instance. The Request#axios workaround fallback is gone.

Tests

New regression test that simulates a freshly booted app (no prior repository use) with baseURL + dataKey in the global plugin config — fails with 404 before the fix, passes after. Full axios suite green (23 tests).

fixes #1987

AxiosRepository captured the axios instance and global plugin config in
its constructor, but ORM plugins only run after the repository has been
constructed. On the first useAxiosRepo() call of an app the repository
therefore saw an empty global config and options like baseURL and
dataKey were silently dropped.

The axios instance and global config are now resolved lazily from the
plugin config the repository receives during plugin registration.

fixes #1987
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.50%. Comparing base (a7cc431) to head (8a2dcb0).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2028      +/-   ##
==========================================
+ Coverage   99.43%   99.50%   +0.06%     
==========================================
  Files          82       82              
  Lines        3019     3019              
  Branches      529      529              
==========================================
+ Hits         3002     3004       +2     
+ Misses         14       12       -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 870ec32 into main Jul 19, 2026
13 checks passed
@CodeDredd
CodeDredd deleted the fix/axios-global-config-first-use branch July 19, 2026 21:27
@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.

Axios plugin: baseURL and dataKey is not utilised during queries

2 participants