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

Fix an issue with a stale editor reference in shape utils #2295

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

MitjaBezensek
Copy link
Contributor

@MitjaBezensek MitjaBezensek commented Dec 6, 2023

Fixes an issue where the editor reference in shape utils was not up to date with the editor returned from useEditor. Actually, the whole util was the incorrect one and was holding a reference to the previous instantiation of the editor.

This only occurred in dev mode, but could also happen in other cases where editor is created multiple times. To see the kinds of issues this causes in dev mode you can do the following:

  1. Create an image, crop it.
  2. Refresh the page.
  3. Select the image, then double click it to enter crop mode.
  4. You will not see the cropped area of the image. You need to change the crop slightly and then it suddenly appears. This is because this changes props, which reruns the memoized function.

Fixes #2284

Change Type

  • patch — Bug fix
  • minor — New feature
  • major — Breaking change
  • dependencies — Changes to package dependencies1
  • documentation — Changes to the documentation only2
  • tests — Changes to any test code only2
  • internal — Any other changes that don't affect the published package2
  • I don't know

Release Notes

  • Fix an issue where the shape utils could have a stale reference to the editor.

Footnotes

  1. publishes a patch release, for devDependencies use internal

  2. will not publish a new version 2 3

@huppy-bot huppy-bot bot added the bugfix Bug fix label Dec 6, 2023
Copy link

vercel bot commented Dec 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
examples ✅ Ready (Inspect) Visit Preview Dec 6, 2023 1:25pm

Copy link
Collaborator

@ds300 ds300 left a comment

Choose a reason for hiding this comment

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

Well done on finding this one!

@MitjaBezensek MitjaBezensek added this pull request to the merge queue Dec 6, 2023
Merged via the queue into main with commit 0cf6a1e Dec 6, 2023
5 checks passed
@MitjaBezensek MitjaBezensek deleted the mitja/fix-editor-issues branch December 6, 2023 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Cropping preview sometimes does not work until you change the crop
2 participants