From aa4a137a0d8cda1fc59ade5fe72a0b5e696effff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuzhan=20Koral?= <45078678+oguzhankoral@users.noreply.github.com> Date: Mon, 16 Jun 2025 21:17:43 +0300 Subject: [PATCH] handle size in MB separately (#168) --- src/powerbi-visual/src/utils/matrixViewUtils.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/powerbi-visual/src/utils/matrixViewUtils.ts b/src/powerbi-visual/src/utils/matrixViewUtils.ts index f616f55..23533bd 100644 --- a/src/powerbi-visual/src/utils/matrixViewUtils.ts +++ b/src/powerbi-visual/src/utils/matrixViewUtils.ts @@ -296,9 +296,14 @@ async function fetchStreamedDataForModel( const endObjectCleanup = performance.now() console.log(`Objects cleaned up in: ${(endObjectCleanup - startObjectCleanup) / 1000} s`) - const sizeInBytes = new TextEncoder().encode(JSON.stringify(objects)).length - const sizeInMB = sizeInBytes / (1024 * 1024) - console.log(`Size of objects: ${sizeInMB} MB`) + try { + const sizeInBytes = new TextEncoder().encode(JSON.stringify(objects)).length + const sizeInMB = sizeInBytes / (1024 * 1024) + console.log(`Size of objects: ${sizeInMB} MB`) + } catch (error) { + console.log("Can't calculate the size of the model") + console.log(error) + } return objects } catch (error) {