perf(web): minify static assets and lazy-load Settings/Saved/Mirror#234
Open
Danialsamadi wants to merge 3 commits into
Open
perf(web): minify static assets and lazy-load Settings/Saved/Mirror#234Danialsamadi wants to merge 3 commits into
Danialsamadi wants to merge 3 commits into
Conversation
Rebasing our fork's main onto upstream/main (which independently gained an equivalent Remove(size, crc) for the same saved-media feature) produced a duplicate method declaration that fails to build. Keep upstream's version — it already maintains curBytes accounting that ours skipped.
Serve embedded CSS/JS/HTML through a one-time startup minification pass (tdewolff/minify) instead of raw bytes, and stop shipping Settings, Saved Messages, and Mirror's JS/CSS on every page load — they now load on first use via loadFeature() in core.js. Cuts initial payload and parse time for the default Feed view, which is what most sessions only ever touch. Moves .msg-save-btn and .sm-header-actions/.saved-channel-entry base rules from the now-lazy saved.css into the eager stylesheets they actually need to apply in, since those elements render unconditionally on the default view. Also fixes profile re-import creating a duplicate profile when the same domain+key config is imported twice. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
Author
|
Reopening — this was the intended target after all. |
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.
Summary
tdewolff/minify) instead of raw bytes, cutting bytes sent per request.loadFeature()helper incore.js. The default Feed view no longer pays for code most sessions never touch..msg-save-btnand.sm-header-actions/.saved-channel-entryhad their base CSS rules living in the now-lazysaved.css, but the elements they style render unconditionally on the default view — moved those base rules into the eager stylesheets (media.css/layout.css) that actually load on first paint. Without this, both showed up as visibly duplicated/stray buttons in the chat header.Verification
go build ./...andgo test ./internal/web/...pass.saved.cssagainst all eagerly-loaded JS/HTML — no other instances of the same bug pattern.loadFeature()is safe against a double-click race (second call chains onto the same in-flight promise, no duplicate<script>/<link>injection), and the HTML minifier doesn't corrupt the inline theme/first-run-language scripts inindex.html.Known follow-up (out of scope here)
Domain+Key; re-importing the same domain/key with a differentServerKey/resolver list silently drops the new config's other fields. Tracked separately, not touched in this PR beyond the exact-duplicate case.Test plan
🤖 Generated with Claude Code