Skip to content

Conversation

@HreshchyshynT
Copy link

First time contributor checklist:

Contributor checklist:

  • My contribution is not related to translations.
  • My commits are in nice logical chunks with good commit messages
  • My changes are rebased on the latest main branch
  • A pnpm run ready run passes successfully (more about tests here)
  • My changes are ready to be shipped to users

Description

This PR fixes #7456

Initial problem: background image dissapeared after undo of a first drawing, adding text or sticker.

Reason: it happened because MediaEditor did initial canvas snapshot before background image was set.

Fix: take snapshot after canvas's background image is set.

Testing: I've added ts/test-mock/messaging/media_editor_test.ts. 'can undo after drawing a line' test fails with current implementation and succeed after fix. It basically reproduces user behavior: run app, open chat, add attachment, open editor, draw a line and tap undo.

OS: macOS Sequoia 15.6.1

I didn't work with react, electron, or js/ts projects before, so my solution and tests may not align with best practices or some code styles. I'm happy to adjust anything based on your comments - I just encounter this bug often and want it to be fixed.

Initial snapshot was takken before background image was set to canvas.
When undoing this caused canvas to restore to a state without
background.

Now wait for background image to exist in fabric canvas and take initial
snaphot in separate effect.
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.

Can't revert edited photo on which I drew something back to the original photo

1 participant