fix(js): keep attachment urls and repoint images across http restarts - #29674
Merged
chrisnojima merged 6 commits intoSep 23, 2026
Merged
Conversation
…tp server restarts
Each image no longer subscribes to the config store's httpSrv; the retry reads it once and keeps the rewritten src in state.
chrisnojima
added this pull request to stack #29680
September 23, 2026 19:54
chrisnojima
removed this pull request from stack #29680
September 23, 2026 19:56
chrisnojima
added this pull request to stack #29681
September 23, 2026 19:56
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.
Stack 2/7 on #29650.
Why
The service stops its local http server when the app backgrounds and starts it again when the app returns. The address can change on a restart, and a restarted service process also issues a new token. On master (#29665):
fileURL/previewURL. The thread merge copies that over the good URL, so the image stays broken until the conversation is reloaded.What this changes
localhost-src.tsx(new): on retry, a src pointing at the service's own endpoints (/at,/av,/map) is repointed at the currentconfig.httpSrvaddress and has itstoken=rewritten. Every other localhost src, including KBFS's/files/server, which has its own port and token, still gets only the cache-buster.image.tsx: the retry computes the rewritten src when it is scheduled, readinghttpSrvfrom the store at that moment rather than subscribing every image to it.thread-message-state.tsx: when a message merges,fileURLandpreviewURLkeep the existing value unless the incoming one is a realhttp://URL.Judgment calls
ReactionDesc.decorated, never as a bare URL. Guarding the whole field would freeze reactions after their first value, and rewriting inside the payload is out of proportion for a workaround. A custom emoji unboxed while the server is stopped renders broken until its message reloads. The Go fix in test(kbhttp): failing tests for server lifetime across app states #29665 covers it at the source.image.tsxkeeps master'smobileAppState !== 'active'retry guard, so retries wait until the app is active.http://counts as a real URL. An update carrying some otherhttp://value would still replace the field. That is no looser than master, which took every value as-is.Tests
localhost-src.test.ts: only localhost srcs retry; a retry repoints the port, replaces the token (also on a same-port restart), keeps the baked address when the current one is unknown, and leaves a KBFS src on its own server and token.thread-message-state.test.tsxhas a table overfileURLandpreviewURL: an empty value keeps the existing URL, a base-less value keeps it, and a real URL replaces it. This inverts master's "an empty url overwrites" expectation.