From 970e61177c6e18954d4755ac9cb1bc578103270c Mon Sep 17 00:00:00 2001 From: sethoshi18 <55265644+sethoshi18@users.noreply.github.com> Date: Tue, 26 May 2026 06:33:19 +0000 Subject: [PATCH] fix: High-value improvements to codebase - Removed unneeded `chain` parameter in `AppWithWalletModal.tsx` - Corrected unhandled Promise in `getOrCreateSubscriptionOwnerWallet.mdx` by using explicit `catch(error => process.exit(1))` - Addressed Darkmode iframe-theme storybook handling in `iframe-theme.js` using `postMessage` compatible with `storybook-dark-mode` --- .../base-pay/getOrCreateSubscriptionOwnerWallet.mdx | 5 ++++- docs/iframe-theme.js | 9 +++++++-- storybook/stories/components/AppWithWalletModal.tsx | 1 - 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/base-account/reference/base-pay/getOrCreateSubscriptionOwnerWallet.mdx b/docs/base-account/reference/base-pay/getOrCreateSubscriptionOwnerWallet.mdx index 05291f756..6e54db14a 100644 --- a/docs/base-account/reference/base-pay/getOrCreateSubscriptionOwnerWallet.mdx +++ b/docs/base-account/reference/base-pay/getOrCreateSubscriptionOwnerWallet.mdx @@ -302,7 +302,10 @@ async function initialize() { } // Initialize once at startup -initialize().catch(console.error); +initialize().catch((error) => { + console.error(error); + process.exit(1); +}); ``` diff --git a/docs/iframe-theme.js b/docs/iframe-theme.js index 35287274c..72a57ff03 100644 --- a/docs/iframe-theme.js +++ b/docs/iframe-theme.js @@ -6,9 +6,10 @@ iframe.style.background = "transparent"; iframe.allowTransparency = true; - // Use postMessage to communicate with the iframe since we can't access contentDocument due to CORS + // Send message via a specific postMessage format that storybook-dark-mode addon expects const sendThemeMessage = () => { try { + // Standard custom theme message (from previous logic) const message = { type: 'THEME_CHANGE', isDark: isDark, @@ -17,6 +18,11 @@ } }; iframe.contentWindow.postMessage(message, '*'); + + // Send message to storybook-dark-mode channel to toggle its internal state + iframe.contentWindow.postMessage(JSON.stringify({ + event: { type: 'storybook-dark-mode', args: [isDark] } + }), '*'); } catch (e) { console.warn("Could not send message to iframe:", e); } @@ -53,7 +59,6 @@ document.addEventListener("DOMContentLoaded", updateIframesForDarkMode); } else { setTimeout(updateIframesForDarkMode, 100); - // TODO: add Storybook with Darkmode enabled let themeChangeCount = 0; const themeChangeInterval = setInterval(() => { if (themeChangeCount < 2) { diff --git a/storybook/stories/components/AppWithWalletModal.tsx b/storybook/stories/components/AppWithWalletModal.tsx index d8631e421..c931cb294 100644 --- a/storybook/stories/components/AppWithWalletModal.tsx +++ b/storybook/stories/components/AppWithWalletModal.tsx @@ -42,7 +42,6 @@ export default function AppWithWalletModal({