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

[Bug]: Cropping preview sometimes does not work until you change the crop #2284

Closed
1 task done
MitjaBezensek opened this issue Dec 5, 2023 · 0 comments · Fixed by #2295
Closed
1 task done

[Bug]: Cropping preview sometimes does not work until you change the crop #2284

MitjaBezensek opened this issue Dec 5, 2023 · 0 comments · Fixed by #2295
Labels
bug Something isn't working

Comments

@MitjaBezensek
Copy link
Contributor

MitjaBezensek commented Dec 5, 2023

Looks like this only happens locally and it might be due to strict mode?

What happened?

For me it happens every time when:

  1. I have a cropped image.
  2. I refresh the page.

As soon as I interact with the image it starts to show the cropped area correctly. Happens in all browsers.

How can we reproduce the bug?

CleanShot.2023-12-05.at.09.42.12.mp4

What browsers are you seeing the problem on?

Firefox, Chrome, Safari

Contact Details

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@MitjaBezensek MitjaBezensek added the bug Something isn't working label Dec 5, 2023
github-merge-queue bot pushed a commit that referenced this issue 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

- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version

### Release Notes

- Fix an issue where the shape utils could have a stale reference to the
editor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant