Skip to content

Conversation

@maxy-shpfy
Copy link
Collaborator

@maxy-shpfy maxy-shpfy commented Dec 2, 2025

Description

Closes #1403

Refactored component duplication and library management to use hydrated component references. This PR eliminates the need to repeatedly serialize/deserialize components with js-yaml.

Key changes:

  • Added a replaceComponentName helper function to modify component names directly in the text
  • Updated ComponentDuplicateDialog to work with hydrated components
  • Modified FavoriteComponentToggle to hydrate components before adding them to the library
  • Updated the component library provider to handle hydrated components throughout

Type of Change

  • Improvement
  • Cleanup/Refactor

Checklist

  • I have tested this does not break current pipelines / runs functionality
  • I have tested the changes on staging

Test Instructions

Screen Recording 2025-12-01 at 8.29.44 PM.mov (uploaded via Graphite)

  1. Follow video to test the functionality.
  2. Open any component for edit in YAML editor (not Python).
  3. Add multiple lines of strings (e.g. #1​ like comments)
  4. Save. Observe the Duplicate dialog. Test that dialog works exactly same as in staging/production
  5. Ensure, that after subsequent edits of the same component does not alterate the content of component (adding new lines, or collapsing lines into one line).
  6. Follow examples from the ticket Component Editor - Editing component deletes/adds newlines, breaking the component every time you save it #1403
  7. Ensure that remaining functionality has no regressions (e.g. adding components via Canvas drops, adding removing components from favorites).

Notes

  • This PR does not address round-trip issues with "Component Details" e.g. download YAML or Implementation Code (which comes from Spec, not Text).

Copy link
Collaborator Author

maxy-shpfy commented Dec 2, 2025

@maxy-shpfy maxy-shpfy force-pushed the 12-01-fix_component_text_corruption_in_duplicate_dialog branch 2 times, most recently from 8470ca4 to 02da690 Compare December 2, 2025 04:29
@maxy-shpfy maxy-shpfy marked this pull request as ready for review December 2, 2025 04:34
Copy link
Collaborator

@camielvs camielvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a smart and comprehensive solution. Nice!

For clarity: which GitHub issues is this specifically trying to fix?

Also: I notice I can overwrite any component in the library by entering an identical name into the duplicate dialog and using "import as new"

Comment on lines +211 to +215
return {
text,
digest: await generateDigest(text),
name: newName,
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT:

  const digest = await generateDigest(text);

  return {
    text,
    digest,
    name: newName,
  };

Copy link
Collaborator Author

^ @camielvs the ticket to solve is #1403 - missed to add to description

@maxy-shpfy maxy-shpfy force-pushed the 12-01-fix_component_text_corruption_in_duplicate_dialog branch from 02da690 to 80ed20c Compare December 2, 2025 17:14
Copy link
Collaborator

@camielvs camielvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still unable to reproduce the original issue on master or production. But nonetheless, on this branch I see things are a little more stable for edited components. LGTM

Copy link
Collaborator Author

maxy-shpfy commented Dec 3, 2025

Merge activity

  • Dec 3, 3:52 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Dec 3, 3:53 PM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 3, 3:54 PM UTC: @maxy-shpfy merged this pull request with Graphite.

@maxy-shpfy maxy-shpfy force-pushed the 12-01-fix_component_text_corruption_in_duplicate_dialog branch from 80ed20c to 1adebc1 Compare December 3, 2025 15:52
@maxy-shpfy maxy-shpfy merged commit 304f7b9 into master Dec 3, 2025
5 checks passed
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.

Component Editor - Editing component deletes/adds newlines, breaking the component every time you save it

4 participants