Skip to content

Handle empty page snapshots safely#11

Open
715494637 wants to merge 1 commit into
zhizhuodemao:mainfrom
715494637:fix/mcp-empty-page-selection
Open

Handle empty page snapshots safely#11
715494637 wants to merge 1 commit into
zhizhuodemao:mainfrom
715494637:fix/mcp-empty-page-selection

Conversation

@715494637

Copy link
Copy Markdown

Summary

  • avoid selecting an undefined page when the filtered page snapshot is empty
  • clear the selected page and dialog binding when all pages disappear
  • add focused tests for empty page snapshots and undefined page selection

Problem

createPagesSnapshot() can currently call selectPage(this.#pages[0]) even when this.#pages is empty. That falls through to newPage.on(...) and crashes with Cannot read properties of undefined (reading 'on').

Testing

  • bun run build
  • node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test build/tests/McpContext.test.js

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