From cdb9a9cd1476301e4f53127c5c69a8f982c9f96e Mon Sep 17 00:00:00 2001 From: Agnik47 <140933190+Agnik47@users.noreply.github.com> Date: Wed, 2 Sep 2026 03:44:54 +0530 Subject: [PATCH] fix(browser-extension): guard project name against null textContent `createProjectSelectionModal` declares its `onImport` callback with a non-nullable `name`, but the call site passed `Node.textContent`, which the DOM lib types as `string | null` under `Node`: utils/ui-components.ts(611,13): error TS2345: Argument of type '{ id: string; name: string | null; containerTag: string; }' is not assignable to parameter of type '{ id: string; name: string; containerTag: string; }'. Fall back to an empty string, matching the `containerTag` line directly below it and every other `.textContent` read in the extension. Runtime behaviour is unchanged: the options are built with `option.textContent = project.name`, so the value is always a string, and the disabled placeholder carries `value = ""` so the `if (selectedOption.value)` guard already excludes it. Also add a change-gated browser-extension `check-types` step to CI. The package was never type-checked there, which is why this survived on main; the step follows the existing SDK/playground detection pattern so it only runs when apps/browser-extension changes. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_017QSriDRoFLVze1BZGrAJHV --- .github/workflows/ci.yml | 12 +++++++++++- apps/browser-extension/utils/ui-components.ts | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ccdb7a18..2b8d18433 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: - name: Install dependencies run: bun install --frozen-lockfile - - name: Detect SDK and playground changes + - name: Detect SDK, playground and browser extension changes id: sdk-changes run: | if git diff --quiet "${{ github.event.pull_request.base.sha }}" HEAD -- packages/tools; then @@ -47,6 +47,12 @@ jobs: echo "sdk_playground=true" >> "$GITHUB_OUTPUT" fi + if git diff --quiet "${{ github.event.pull_request.base.sha }}" HEAD -- apps/browser-extension; then + echo "browser_extension=false" >> "$GITHUB_OUTPUT" + else + echo "browser_extension=true" >> "$GITHUB_OUTPUT" + fi + - name: Setup Python for SDK Playground if: steps.sdk-changes.outputs.sdk_playground == 'true' uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 @@ -98,6 +104,10 @@ jobs: if: steps.sdk-changes.outputs.sdk_playground == 'true' run: bun run --cwd apps/sdk-playground build:app + - name: Run Browser Extension type checking + if: steps.sdk-changes.outputs.browser_extension == 'true' + run: bun run --cwd apps/browser-extension check-types + - name: Run Memory Graph type checking run: bun run --cwd packages/memory-graph check-types diff --git a/apps/browser-extension/utils/ui-components.ts b/apps/browser-extension/utils/ui-components.ts index 2ed576907..71607baff 100644 --- a/apps/browser-extension/utils/ui-components.ts +++ b/apps/browser-extension/utils/ui-components.ts @@ -605,7 +605,7 @@ export function createProjectSelectionModal( if (selectedOption.value) { const selectedProject = { id: selectedOption.value, - name: selectedOption.textContent, + name: selectedOption.textContent ?? "", containerTag: selectedOption.dataset.containerTag || "", } onImport(selectedProject)