fix(axios): apply global plugin config on first repository use#2028
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This was referenced Jul 19, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
AxiosRepositorycapturedconfig.axiosApi(axios instance + global plugin config) in its constructor — but ORM plugins are registered viaregisterPlugins()after the repository is constructed. On the firstuseAxiosRepo()call of an app the repository therefore saw an emptyglobalApiConfig, and global options likebaseURLanddataKeywere silently dropped from every request built by that repository (#1987).The axios instance itself only appeared to work because
Request#axioshad a fallback torepository.config.axiosApi.axios.Fix
axiosandglobalApiConfigare now lazy getters that resolve fromthis.config.axiosApi— the plugin-merged config the repository receives viasetConfig()during plugin registration.setAxios()still overrides the instance. TheRequest#axiosworkaround fallback is gone.Tests
New regression test that simulates a freshly booted app (no prior repository use) with
baseURL+dataKeyin the global plugin config — fails with 404 before the fix, passes after. Full axios suite green (23 tests).fixes #1987