statelyai / xstate-viz

Visualizer for XState machines
https://stately.ai/viz
MIT License
434 stars 102 forks source link

Text Describing State Names and Actions are Truncated in Visualization #397

Open shayank24 opened 1 year ago

shayank24 commented 1 year ago

Description

In the visualization of my state machine, text describing state names and actions is being truncated. For example:

  1. A state named policyOutcomeComponentState displays as policyOutcomeComponen...
  2. An action occurring on a POLICY event that assigns policyId and policyUrl values in the context, only displays DO / assign policyId, p...

Text truncation in the visualization is reducing readers' ability to comprehend how context and state are changing as users flow through the state machine. Visualizations should offer a display without any truncation of state names / assignment actions.

Expected Result

  1. When visualizing a state machine containing a state with a lengthy name (e.g. policyOutcomeComponentState), I expect the visualization to display the full name of the state.

  2. When visualizing an action where multiple fields are being assigned to the state machine context, I expect the visualization to show all fields that are assigned.

Actual Result

  1. When visualizing a state named policyOutcomeComponentState, the state machine visualization shows a truncated state name (policyOutcomeComponen...)

  2. When visualizing an action with multiple assignments (policyId and policyUrl), the state machine visualization truncates the text in the assignment action showing only DO / assign policyId, p...

Reproduction

Snippet from larger state machine: image

Additional context

I am new to this visualization tool. If there is already an option to visualize the state machine without truncating any text, please help to point me in that direction. Thank you in advance!

Glavin001 commented 1 year ago

I think this is the applicable code:

Before After
image image
image image

I recommend someone create a Pull Request 🤞

I doubt I'll have a chance this weekend. Maybe next weekend, if someone has not beaten me to it already 😉


@davidkpiano : Would a configuration option be suitable for this or do you recommend another way?