Skip to content

[FEAT] Sidebar Svelte Favicon Support #516

@stickerdaniel

Description

@stickerdaniel

Feat: Svelte favicon support

Svelte/SvelteKit projects in the sidebar don’t resolve their real project favicon and fall back to a generic folder icon. The sidebar favicon loading also needs to avoid layout shift and cached-image race conditions.

Implementation Prompt
Implement Svelte/SvelteKit sidebar project favicon support in t3code by extending /api/project-favicon server--side. Resolve icons in this order: real favicon files, parsed icon links (including src/app.html and %sveltekit.assets%/..• → static/... ), then Svelte fallback, then generic fallback. Detect Svelte only from strong root markers in projectIconFallback.ts: svelte.config.*, •svelte-kit/, or package. json deps containing svelte / @sveltejs/kit .

Serve fallback icons from checked-in asset files:

• apps/server/src/assets/project-favicon-default.svg
• apps/server/src/assets/project-favicon-svelte.svg

Add a helper to load those SVGs and update the server build script so they are copied into dist/assets

Update tests in apps/server/src/projectFaviconRoute.test.ts to cover real favicon resolution, SvelteKit %sveltekit. assets% resolution, Svelte fallback detection, precedence rules, and generic fallback, asserting against
asset-backed SVG constants.

Also fix sidebar layout shift in apps/web/src/components/Sidebar.tsx: reserve a fixed icon slot, show nothing while
loading, pop the favicon in immediately on success, and keep showing the folder icon only on error. Validate with bun lint and bun typecheck
Before After

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions