Skip to content

Conversation

sauravbaid3
Copy link

Problem

  • When leaving the input field empty in the Format Prompt Values dialog and clicking on Copy to clipboard, the app:
    Throws a console error:
    TypeError: Cannot read properties of undefined (reading 'writeText')

  • Turns the page blank

  • Causes unsaved flow data to be lost

Root Cause

  • navigator.clipboard.writeText was being called without checking if the Clipboard API was available
  • Empty string values ("") were not being handled safely, leading to JSON parsing and clipboard issues

Solution

This PR improves clipboard handling across components by:

  • Adding Clipboard API availability checks (if (navigator?.clipboard?.writeText))

  • Wrapping copy operations in try/catch blocks for safer error handling

  • Gracefully handling empty values ("") without breaking the UI

  • Applying the same safety pattern consistently across components:
    JsonEditor.jsx
    ExpandedChunkDialog.jsx
    NodeExecutionDetails.jsx

Result

No more crashes or blank pages when copying empty/invalid input
Consistent clipboard handling across the app
Better browser compatibility and error resilience

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