fix!: settings endpoint usage #3258
Merged
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.
Greptile Summary
This PR refactors how the settings backend endpoint is resolved by moving the configuration lookup from API construction time to runtime evaluation in the
getPath()method.Key changes:
setBaseUrlOverride()method andbaseUrlOverridefield fromMetaSettingsAPIuiFactoryimport fromsrc/services/api/index.tstosrc/services/api/metaSettings.tsgetPath()call instead of being cached during initializationImpact:
src/store/reducers/settings/api.tswhereresolveRemoteSettingsClientAndUser()also checksuiFactorydynamicallygetPath()is not called frequently enough to cause concernsConfidence Score: 5/5
Important Files Changed
uiFactoryimport and base URL override logic from constructor, simplifying initializationgetPath()method, evaluating configuration dynamically on each callSequence Diagram
sequenceDiagram participant App as Application participant API as YdbEmbeddedAPI participant MSA as MetaSettingsAPI participant UIF as uiFactory participant Backend as Settings Backend Note over App,Backend: Before (Old Implementation) App->>API: new YdbEmbeddedAPI(useMetaSettings: true) API->>UIF: settingsBackend?.getEndpoint() API->>UIF: settingsBackend?.getUserId() API->>MSA: new MetaSettingsAPI() API->>MSA: setBaseUrlOverride(endpoint) Note over MSA: Stores endpoint in baseUrlOverride field App->>MSA: getSingleSetting({name, user}) MSA->>MSA: getPath(path) Note over MSA: Uses cached baseUrlOverride MSA->>Backend: HTTP Request to endpoint Backend-->>MSA: Response MSA-->>App: Setting value Note over App,Backend: After (New Implementation) App->>API: new YdbEmbeddedAPI(useMetaSettings: true) API->>MSA: new MetaSettingsAPI() Note over MSA: No endpoint cached App->>MSA: getSingleSetting({name, user}) MSA->>MSA: getPath(path) MSA->>UIF: settingsBackend?.getEndpoint() MSA->>UIF: settingsBackend?.getUserId() Note over MSA: Resolves endpoint dynamically MSA->>Backend: HTTP Request to endpoint Backend-->>MSA: Response MSA-->>App: Setting valueCI Results
Test Status:⚠️ FLAKY
📊 Full Report
Test Changes Summary ⏭️2
⏭️ Skipped Tests (2)
Bundle Size: ✅
Current: 62.61 MB | Main: 62.61 MB
Diff: 0.65 KB (-0.00%)
✅ Bundle size unchanged.
ℹ️ CI Information