Skip to content

fix(debugger): disable copy button when Call Stack has no frames#69

Open
HuiNeng6 wants to merge 1 commit intoCortexLM:mainfrom
HuiNeng6:fix-callstack-copy-empty-frames
Open

fix(debugger): disable copy button when Call Stack has no frames#69
HuiNeng6 wants to merge 1 commit intoCortexLM:mainfrom
HuiNeng6:fix-callstack-copy-empty-frames

Conversation

@HuiNeng6
Copy link

Summary

  • Add guard in \handleCopyStack\ to return early if frames array is empty
  • Disable copy button when there are no stack frames to prevent empty clipboard overwrite
  • Fixes issue where copy action could silently wipe user's clipboard with empty string

Problem

In the mounted Call Stack panel, the toolbar copy action remained visible and clickable even when there were no stack frames to copy. Clicking it in that state would build an empty string and send it to the clipboard, potentially wiping user's clipboard content.

Solution

  1. Added early return guard in \handleCopyStack\ function when \ rames().length === 0\
  2. Added \disabled={frames().length === 0}\ prop to the copy IconButton

Testing

  1. Open Run and Debug
  2. Reach a state where Call Stack has no frames to show (not paused, or selected thread with empty stack)
  3. Verify copy button is disabled/unclickable
  4. Verify clipboard is not overwritten

Fixes #37588 (reported in PlatformNetwork/bounty-challenge)

- Add guard in handleCopyStack to return early if frames array is empty
- Disable copy button when there are no stack frames to prevent empty clipboard overwrite
- Fixes issue where copy action could silently wipe user's clipboard with empty string

Fixes #37588
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