mirror of
https://github.com/ramvignesh-b/pi-ku.git
synced 2026-05-04 08:56:52 +00:00
fix: resolve non-null assertion linting in Reader and add null check for fabricRef in ComposeCanvas
This commit is contained in:
@@ -401,6 +401,8 @@ export const ComposeCanvas = forwardRef<
|
|||||||
fabricRef.current?.add(img);
|
fabricRef.current?.add(img);
|
||||||
fabricRef.current?.setActiveObject(img);
|
fabricRef.current?.setActiveObject(img);
|
||||||
|
|
||||||
|
if (!fabricRef.current) return;
|
||||||
|
|
||||||
logicalSizeRef.current.height = measureLogicalContentHeight(
|
logicalSizeRef.current.height = measureLogicalContentHeight(
|
||||||
fabricRef.current,
|
fabricRef.current,
|
||||||
logicalSizeRef.current.height,
|
logicalSizeRef.current.height,
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ export default function Reader() {
|
|||||||
)
|
)
|
||||||
: await cryptoUtils.decryptMetadata(
|
: await cryptoUtils.decryptMetadata(
|
||||||
{ encrypted_content: encrypted_metadata, encrypted_dek },
|
{ encrypted_content: encrypted_metadata, encrypted_dek },
|
||||||
masterKey,
|
// biome-ignore lint/style/noNonNullAssertion: masterKey is guaranteed to be non-null here as isDecryptionKeyAvailable is true
|
||||||
|
masterKey!,
|
||||||
);
|
);
|
||||||
setMetadata(decryptedMetadata as LetterMetadata);
|
setMetadata(decryptedMetadata as LetterMetadata);
|
||||||
|
|
||||||
@@ -81,7 +82,8 @@ export default function Reader() {
|
|||||||
)
|
)
|
||||||
: await cryptoUtils.decryptLetter(
|
: await cryptoUtils.decryptLetter(
|
||||||
{ encrypted_content, encrypted_dek },
|
{ encrypted_content, encrypted_dek },
|
||||||
masterKey,
|
// biome-ignore lint/style/noNonNullAssertion: masterKey is guaranteed to be non-null here as isDecryptionKeyAvailable is true
|
||||||
|
masterKey!,
|
||||||
);
|
);
|
||||||
|
|
||||||
const canvasData: CanvasJSON = JSON.parse(decryptedContent);
|
const canvasData: CanvasJSON = JSON.parse(decryptedContent);
|
||||||
@@ -100,7 +102,8 @@ export default function Reader() {
|
|||||||
canvasData,
|
canvasData,
|
||||||
images,
|
images,
|
||||||
encrypted_dek,
|
encrypted_dek,
|
||||||
masterKey,
|
// biome-ignore lint/style/noNonNullAssertion: masterKey is guaranteed to be non-null here as isDecryptionKeyAvailable is true
|
||||||
|
masterKey!,
|
||||||
cryptoUtils,
|
cryptoUtils,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -108,7 +111,7 @@ export default function Reader() {
|
|||||||
setWarning({
|
setWarning({
|
||||||
message:
|
message:
|
||||||
"Failed to decrypt elements. Images might not render in the letter as intended.",
|
"Failed to decrypt elements. Images might not render in the letter as intended.",
|
||||||
log: err,
|
log: err instanceof Error ? err.message : "Unknown error",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user