Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to `@cofoundy/ui` are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.6.1] — 2026-05-22

### Fixed

- **`CommandPaletteTrigger` flashed unstyled before the palette was first opened.** The singleton stylesheet (`<style id="cp-styles">`) was injected inside `PaletteSurface`'s mount effect, which only runs when `open=true`. The trigger pill mounts long before that, so its `.cp-trigger` rules didn't exist on first paint. Moved the injection to module-import time (after `COMMAND_PALETTE_CSS` is initialized, behind a `typeof document` guard so SSR stays safe). The trigger now renders styled from the first render, regardless of whether the palette has ever been opened.

## [0.6.0] — 2026-05-22

### Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cofoundy/ui",
"version": "0.6.0",
"version": "0.6.1",
"private": true,
"type": "module",
"main": "./src/index.ts",
Expand Down
10 changes: 10 additions & 0 deletions src/components/command-palette/CommandPalette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ function ensureCommandPaletteStyles() {
document.head.appendChild(el);
stylesInjected = true;
}
// NOTE: the eager-inject call lives at the bottom of this file, after
// COMMAND_PALETTE_CSS is initialized. Calling it here would hit a TDZ since
// the const-style template literal isn't bound yet at module-evaluation top.

/**
* Body scroll-lock counter. Composes safely with sibling modals — the lock
Expand Down Expand Up @@ -1806,4 +1809,11 @@ const COMMAND_PALETTE_CSS = `
.cp-kbd-meta { font-size: 11px; margin-right: 1px; }
`;

// Eager-inject the singleton stylesheet on client-side module import so
// `CommandPaletteTrigger` renders styled even before the palette has ever
// opened. Without this, the trigger pill loses its `.cp-trigger` rules until
// the user fires Cmd+K once — every consumer's header pill flashes unstyled
// on first paint. SSR-safe via the `typeof document` guard inside the helper.
if (typeof document !== 'undefined') ensureCommandPaletteStyles();

export default CommandPalette;
Loading