question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Konva warning: [object Undefined] is a not valid value for "crop" attribute

See original GitHub issue

Despite it’s declaration: crop?: IRect;, Image’s crop can’t handle an undefined value.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lavrtoncommented, Aug 19, 2022

Just pushed a little fix to konva for that case.

0reactions
scottostlercommented, Aug 19, 2022

I ran into a variant of this, when transitioning an image component from having a crop to no longer having a crop. Essentially the following:

if (applyCrop) {
    return <Image crop={...} />
} else {
    return <Image />
}

I didn’t set an undefined crop in my code, but this line would cause that to happen regardless: https://github.com/konvajs/react-konva/blob/950925060d5fd9cca748f570f8edc9f5f3cbfb91/src/makeUpdates.ts#L79

I can work around this by setting the four crop attributes individually (or alternatively, instead of removing the crop, using a no-op crop with the full image dimensions), but figured it was worth reporting

Read more comments on GitHub >

github_iconTop Results From Across the Web

Konva warning: NaN is a not valid value for "radius" · Issue #726
I have "Konva warning: NaN is a not valid value for "radius" attribute. The value should be a number." warning while create a...
Read more >
How to resize and rotate canvas shapes with react and konva?
Type 'MutableRefObject<transformer |="" undefined="">' is not assignable to type 'string | ((instance: Transformer | null) => void) | RefObject<transformer> | ...
Read more >
Class: Image - Konva
The fillPriority property makes it really easy to toggle between different fill ... get crop var crop = image.crop(); // set crop image.crop({...
Read more >
Class: Node - Konva
create node with JSON string or an Object. De-serializtion does not generate custom shape drawing functions, images, or event handlers (this would make...
Read more >
Class: Layer - Konva
clearBeforeDraw, Boolean, <optional>. set this property to false if you don't want to clear the canvas before each layer draw. The default value...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found