Uh oh!
There was an error while loading. Please reload this page.
Conversation
size-limit report 📦
|
| const canvasContainerRef = hooks.useRef<HTMLDivElement>(null); | ||
| const cropContainerRef = hooks.useRef<HTMLDivElement>(null); | ||
| const croppingRef = hooks.useRef<HTMLCanvasElement>(null); | ||
| const annotatingRef = hooks.useRef<HTMLCanvasElement>(null); |
There was a problem hiding this comment.
What if this useRef call was just inside Annotations.tsx?
There was a problem hiding this comment.
it's used in screenshot editor when resizing
There was a problem hiding this comment.
oh i missed that. i'll take another look. it's a non-blocking kind of thing too
❌ 416 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
| setCroppingRect={setCroppingRect} | ||
| resize={resize} | ||
| /> | ||
| <Annotations action={action} imageBuffer={imageBuffer} annotatingRef={annotatingRef} /> |
There was a problem hiding this comment.
Would it work if this was like:
| <Annotationsaction={action}imageBuffer={imageBuffer}annotatingRef={annotatingRef}/> | |
| {action==='annotate' ? <AnnotationsimageBuffer={imageBuffer}annotatingRef={annotatingRef}/> : null} |
same for options._experiments.annotations || action === 'crop' ? <Crop> : null
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
ryan953
left a comment
There was a problem hiding this comment.
splitting into multiple files is a big help. We could probably do something about the number of props, but i'd need too look more closely first.
This works and is an improvement, so i'm all for 🚢
| if (action !== 'crop') { | ||
| return; | ||
| } |
There was a problem hiding this comment.
When/why would this component get a non crop action?
There was a problem hiding this comment.
it's in a useEffect with action as a dependency. This is done so that when you switch from cropping to the annotation tool, the above part of the code will run and clear the rectangle drawn around the image.
| <button | ||
| class={`editor__tool ${action === 'crop' ? 'editor__tool--active' : ''}`} | ||
| onClick={e => { | ||
| e.preventDefault(); |
There was a problem hiding this comment.
what's the default behavior that this stops?
(you might need a type="button" if it's submitting a form)
There was a problem hiding this comment.
it is submitting the form 😬
We are splitting up screenshot editor into 3 additional parts: cropping, annotations, toolbar