Skip to content

Commit

Permalink
Merge pull request #3505 from threefoldtech/dev_fix_toast_err_sentry
Browse files Browse the repository at this point in the history
fix sentry console toast error by updating theme handling
  • Loading branch information
amiraabouhadid authored Oct 9, 2024
2 parents 4fd5606 + 77184a3 commit 77e1941
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/playground/src/utils/custom_toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export function createCustomToast(
type: ToastType,
componentProps?: Record<string, unknown>,
) {
const theme = localStorage.getItem("APP_CURRENT_THEME") || "dark";
const themeElement = document.getElementById("vuetify-theme-stylesheet");
const theme = window.getComputedStyle(themeElement!).colorScheme;

const colors = theme === "dark" ? darkModeColors : lightModeColors;

const toastOptions: ToastOptions = {
Expand All @@ -61,7 +63,6 @@ export function createCustomToast(
const leftIcons = document.getElementsByClassName("mosha__icon");
const closeIcons = document.getElementsByClassName("mosha__toast__close-icon");
const contents = document.getElementsByClassName("mosha__toast__content");

if (leftIcons && closeIcons && contents) {
for (let index = 0; index < leftIcons.length; index++) {
const svgIcon = leftIcons[index].children[0];
Expand Down

0 comments on commit 77e1941

Please sign in to comment.