Repository navigation
Conversation
Author
|
Thanks for looking. I found it through #195, not in production. I reproduced it against a mock server (offlineHandler set without offlineMode, server available): on main the client never contacts the server, with this change it does, and it falls back to the offline file when the server is down. The PR's tests cover the same cases. |
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.
Changes
Contributes to #195.
Only use the offline handler immediately in offline mode. Otherwise, prefer the live environment and fall back to the handler if fetching fails. The fallback is not cached as a live environment, so the next call can recover. A failed refresh still keeps the last good live environment.
How did you test this code?
Added tests for live environment selection, initial failure and recovery, failed refresh, and missing offline handler. The first three fail on main and pass with the fix. Existing offline-mode tests still pass.
Passed the full source/coverage suite, ESM-built suite, CJS/ESM TypeScript build and touched-file Prettier checks on Node 22. A public-package smoke also checked concurrent environment/identity fetch deduplication and offline mode making no network call.