Skip to content

docs(assets): correct the icon bundle docs - #88

Merged
kirillDevPro merged 1 commit into
masterfrom
docs/assets-readme
Sep 26, 2026
Merged

kirillDevPro merged 1 commit into
masterfrom
docs/assets-readme

Conversation

@kirillDevPro

Copy link
Copy Markdown
Collaborator

What was stale

crates/moon-ui-components-assets/README.md still called this crate the default asset bundle for Longbridge GPUI Component. The crate docs said WASM icons are downloaded from a CDN with web_sys::Request, and linked IconName at docs.rs for the upstream gpui-component crate.

What the code does

The package is moon-ui-components-assets (Rust library gpui_component_assets; the workspace depends on it as gpui-component-assets). moon-ui re-exports Assets as MoonAssets. build.rs publishes assets/icons through the Cargo links key gpui-component-default-icons, and moon-ui-components generates IconName from DEP_GPUI_COMPONENT_DEFAULT_ICONS_ICONS_DIR.

Native Assets embeds assets/icons/**/*.svg with RustEmbed. It is a unit struct, and Assets::new ignores its endpoint. On wasm, Assets::new only stores the endpoint. load fetches a path with reqwest from {endpoint}/assets/{path} when the path starts with icons/ and ends with .svg, and caches the bytes. Until that download finishes, load returns an error. The sprite atlas does not store that failure, so a later paint calls load again.

Review

A clean-context pass disputed one README sentence that said Assets::new(endpoint) performs the download. Assets::new only stores the endpoint (wasm_assets.rs). That sentence now attributes the download to load. Nothing else was disputed, and the disputed wording was not left in the diff.

How verified

Checked against native_assets.rs, wasm_assets.rs, both build.rs files, icon.rs, paint_svg, render_alpha_mask, and PlatformAtlas::get_or_insert_with on the DirectX, Metal, and wgpu atlases. cargo fmt --all changed no other files. The example is rust,no_run, and this crate sets doctest = false.

The readme still called this package the Longbridge GPUI Component
asset bundle, and the crate docs said WASM icons come from a CDN via
web_sys::Request. The package is moon-ui-components-assets. Native
builds embed the SVGs with RustEmbed. WASM load fetches icons/*.svg
with reqwest from a caller-supplied endpoint.
@kirillDevPro
kirillDevPro merged commit 0815925 into master Sep 26, 2026
4 checks passed
@kirillDevPro
kirillDevPro deleted the docs/assets-readme branch September 26, 2026 05:23
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