Skip to content

Make images smaller using best-in-class codecs, right in the browser.

JavaScript

Update options when updating state.

Jake Archibald0abb6f18ba90
diff --git a/src/codecs/avif/options.tsx b/src/codecs/avif/options.tsx
index 41d98044..a5533ca1 100644
--- a/src/codecs/avif/options.tsx
+++ b/src/codecs/avif/options.tsx
@@ -134,6 +134,9 @@ export default class AVIFEncoderOptions extends Component<Props, State> {
speed: maxSpeed - optionState.effort,
};
+ // Updating options, so we don't recalculate in getDerivedStateFromProps.
+ newState.options = newOptions;
+
this.setState(
// It isn't clear to me why I have to cast this :)
newState as State,