Skip to content

Commit

Permalink
BZ-37737: fix: Add try catch block to handle error gracefully while u…
Browse files Browse the repository at this point in the history
…pdating max height

- Introduce a try-catch block in updateMaxHeight function of Accordian component to handle error gracefully
  • Loading branch information
nikita.gupta authored and sinha-sahil committed Dec 27, 2024
1 parent 56fdd74 commit 895c7e0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/lib/Accordion/Accordion.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
let accordionRef: HTMLElement;
function updateMaxHeight() {
if (expand) {
accordionRef.style.maxHeight = `${maxHeight}px`;
} else {
accordionRef.style.maxHeight = '0';
try {
if (expand) {
accordionRef.style.maxHeight = `${maxHeight}px`;
} else {
accordionRef.style.maxHeight = '0';
}
} catch (e) {
console.error('Error while updating style of accordian', e);
}
}
Expand Down

0 comments on commit 895c7e0

Please sign in to comment.