Skip to content

fix(discord-app): handle Draft.js search and reply context - #2176

Draft
willzhqiang wants to merge 1 commit into
jackwener:mainfrom
willzhqiang:codex/fix-discord-app-search-read
Draft

fix(discord-app): handle Draft.js search and reply context#2176
willzhqiang wants to merge 1 commit into
jackwener:mainfrom
willzhqiang:codex/fix-discord-app-search-read

Conversation

@willzhqiang

Copy link
Copy Markdown

Summary

  • support Discord's current Draft.js contenteditable search box
  • submit search with complete native Enter key metadata and wait for the asynchronous result root
  • avoid stale and duplicate search rows when consecutive queries run
  • bind message author, timestamp, and content extraction to the current Discord message_id
  • add regression coverage for Draft.js search and reply-context extraction

Root cause

Discord now renders search as a Draft.js div[contenteditable], but the adapter invoked the HTMLInputElement.value setter on it, which raised TypeError: Illegal invocation.

The search command could also scrape the previous result set before the next query finished, and its broad selector matched multiple nested nodes for one result. For channel reads, broad descendant selectors selected the quoted reply context before the current message.

Validation

  • npm test -- --run clis/discord-app/commands.test.js — 23 passed
  • npm run typecheck
  • npm run build
  • isolated full suite — 559 files passed, 6350 tests passed, 1 skipped
  • opencli validate discord-app/search
  • opencli validate discord-app/read
  • live authenticated Discord Desktop regression:
    • consecutive queries returned 3 and 25 relevant rows with no exact duplicates
    • a known reply returned the current author and body instead of the quoted context

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