Skip to content

perf(editor): drop ranui select and the MIME table from startup - #295

Merged
chaxus merged 10 commits into
mainfrom
perf/startup-mime-select
Oct 24, 2026
Merged

chaxus merged 10 commits into
mainfrom
perf/startup-mime-select

Conversation

@chaxus

@chaxus chaxus commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #293, rebased onto main after #294 (which carries the ranui/ranuts 0.5.2 + ranview 0.2.2 upgrade, so this PR no longer touches any dependency file). It removes the last two editor startup items that the sourcemap attribution found.

Change

  • ranui select off the editor startup. index.ts imported ranui/select, but only the assistant renders an r-select, and its modules import the element themselves. The element now registers when the assistant loads.
  • The app's own MIME lookup. lib/converter.ts and packages/converter fell back to ranuts' getExtensions(file.type) for a nameless file. They now use getDocumentExtension, which reverses DOCUMENT_MIME_MAP. It gives the same answer for every supported format except ppt, where getExtensions said pot.
  • Removed the unused getMimeTypeFromExtension from @ranuts/shared (zero production callers).

Measurements (static startup graph from .vite/manifest.json, gzip -9)

Page main 75c2cd96 This PR
/editor 337 KB raw / 105 KB gzip 241 KB raw / 84 KB gzip
/history 168 KB raw / 55 KB gzip 169 KB raw / 56 KB gzip

Step by step on the editor: the select change takes it from 105 KB to 90 KB, and the getExtensions swap from 90 KB to 84 KB. History bytes are unchanged (+0.2 KB raw). Its gzip sum grows about 1 KB only because Rolldown now emits ranui's button as a separate file.

Reverse validation

  • With import 'ranui/select' restored, both select cases fail (the select chunk is in startup scripts, and r-select is defined before the assistant opens).
  • With getExtensions restored in lib/converter.ts, the editor MIME case fails.
  • With ranui and ranuts back at 0.5.1, the MIME cases fail on both pages. The history case now guards build(deps): upgrade ranui to 0.5.2 to stop the language menu flash #294's upgrade.

CI fix

The first run failed the new select case on E2E (Docker image) shard 1. With no saved model, the panel switches itself to settings after an async model-cache check, and the gear toggles. If the check finished first, the click went back to chat. I reproduced this locally by forcing that ordering. The case now waits for the cache summary and presses the gear only when the panel is not already in settings (same as agent-portal-layer.spec.ts). It passes under the forced ordering, and 40 repeats pass.

Verification

After the rebase: lint:ts, format:check, and all unit tests (252 files / 6817 tests) pass, and 66 E2E cases pass (startup payload, entry paths, filename matrix, app smoke, history, language menu, assistant portal layer and workspace). The dependency files are identical to main, and dompurify stays at 3.4.17. A fresh-context review found no bugs. Its doc nits are fixed in the last commit.

Record: docs/explorations/2026-10-24-select-and-mime-table.md.

🤖 Generated with Claude Code

@chaxus
chaxus enabled auto-merge (rebase) October 24, 2026 12:27
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Deploying document with  Cloudflare Pages  Cloudflare Pages

Latest commit: bbc2738
Status: ✅  Deploy successful!
Preview URL: https://d4e019bf.document-7hm.pages.dev
Branch Preview URL: https://perf-startup-mime-select.document-7hm.pages.dev

View logs

chaxus and others added 10 commits October 24, 2026 21:55
Only the assistant renders r-select, and its modules import the element
themselves, so the editor no longer loads it at startup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The open paths fell back to ranuts' getExtensions for a nameless file, which
kept its full MIME table on the editor page. getDocumentExtension reverses
DOCUMENT_MIME_MAP instead, and names ppt correctly (getExtensions said pot).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chaxus
chaxus force-pushed the perf/startup-mime-select branch from f71755a to bbc2738 Compare October 24, 2026 14:00
@chaxus
chaxus merged commit e06953c into main Oct 24, 2026
20 checks passed
@chaxus
chaxus deleted the perf/startup-mime-select branch October 24, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant