Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin toggling is not undo/redo safe. #4446

Open
seanparsons opened this issue Oct 30, 2023 · 0 comments
Open

Pin toggling is not undo/redo safe. #4446

seanparsons opened this issue Oct 30, 2023 · 0 comments
Labels
Bug Something isn't working Inspector Affects the inspector, settings, commands

Comments

@seanparsons
Copy link
Contributor

Describe the bug
If the left and right properties are set on an element and the width pin toggle is triggered, the first time this may work correctly but if the user triggers an undo and does it again then the editor may remove both the left and right properties.

To Reproduce

  1. Create a regular frame child element with left and right style properties.
  2. Trigger the width pin toggle.
  3. Undo the toggle with the undo shortcut.
  4. Trigger the width pin toggle.

Result: Now the element only has the width horizontal style property.

Expected behaviour
The element should have the same properties that it did before the undo action.

Note
It looks to be something to do with these lines in usePinToggling:

  const [lastHorizontalProp, setLastHorizontalProp] = React.useState<LayoutPinnedProp | null>(null)
  const [lastVerticalProp, setLastVerticalProp] = React.useState<LayoutPinnedProp | null>(null)

As lastHorizontalProp being set to width after the first change, but doesn't get reset as a result of the undo.

@seanparsons seanparsons added Bug Something isn't working Inspector Affects the inspector, settings, commands labels Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Inspector Affects the inspector, settings, commands
Projects
None yet
Development

No branches or pull requests

1 participant