From 70b30a061b6babb82e708dd15c90670e93c3d2c6 Mon Sep 17 00:00:00 2001 From: MarketDataApp Date: Mon, 2 Mar 2026 10:40:59 -0300 Subject: [PATCH 1/3] docs: correct endpoint link for bulk stock quotes in cached mode documentation --- api/universal-parameters/mode.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/universal-parameters/mode.md b/api/universal-parameters/mode.md index dc5543e0..92ba7f8b 100644 --- a/api/universal-parameters/mode.md +++ b/api/universal-parameters/mode.md @@ -51,7 +51,7 @@ Data freshness is not guaranteed. Symbols with higher usage across Market Data c * Bulk Candles: Unavailable * Other Endpoints: Unavailable -This makes cached mode particularly cost-effective for bulk quote retrieval using endpoints such as [Option Chain](/api/options/chain) and [Bulk Stock Quotes](/api/stocks/bulkquotes). +This makes cached mode particularly cost-effective for bulk quote retrieval using endpoints such as [Option Chain](/api/options/chain) and [Bulk Stock Quotes](/api/stocks/quotes). ### Requesting Cached Data From 98d816540e7dfe215bd309bb820d7229162f7033 Mon Sep 17 00:00:00 2001 From: MarketDataApp Date: Mon, 2 Mar 2026 15:13:15 -0300 Subject: [PATCH 2/3] feat: add cross-domain dark mode cookie sync via @marketdataapp/ui Sync theme preference cookie across *.marketdata.app subdomains: - Head script reads cookie into localStorage before Docusaurus renders - MutationObserver syncs data-theme changes back to cookie --- docusaurus.config.js | 3 +++ package.json | 1 + plugins/theme-cookie-sync.js | 15 +++++++++++++++ src/clientModules/themeCookieSync.js | 17 +++++++++++++++++ yarn.lock | 4 ++++ 5 files changed, 40 insertions(+) create mode 100644 plugins/theme-cookie-sync.js create mode 100644 src/clientModules/themeCookieSync.js diff --git a/docusaurus.config.js b/docusaurus.config.js index 0e822c4b..1ddaba91 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -64,7 +64,10 @@ const config = { ], ], + clientModules: ['./src/clientModules/themeCookieSync.js'], + plugins: [ + './plugins/theme-cookie-sync', [ "@docusaurus/plugin-client-redirects", { diff --git a/package.json b/package.json index ba603e8a..b87fb2a9 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@docusaurus/plugin-client-redirects": "3.0.1", "@docusaurus/plugin-content-docs": "3.0.1", "@docusaurus/preset-classic": "3.0.1", + "@marketdataapp/ui": "github:MarketDataApp/ui", "@mdx-js/react": "^3.0.0", "clsx": "^2.0.0", "dotenv": "^16.0.2", diff --git a/plugins/theme-cookie-sync.js b/plugins/theme-cookie-sync.js new file mode 100644 index 00000000..726b3b9f --- /dev/null +++ b/plugins/theme-cookie-sync.js @@ -0,0 +1,15 @@ +module.exports = function themeCookieSyncPlugin() { + return { + name: 'theme-cookie-sync', + injectHtmlTags() { + return { + headTags: [ + { + tagName: 'script', + innerHTML: `(function(){var m=document.cookie.match(/(?:^|;\\s*)theme=(dark|light)/);if(m)try{localStorage.setItem('theme',m[1])}catch(e){}})();`, + }, + ], + }; + }, + }; +}; diff --git a/src/clientModules/themeCookieSync.js b/src/clientModules/themeCookieSync.js new file mode 100644 index 00000000..46473798 --- /dev/null +++ b/src/clientModules/themeCookieSync.js @@ -0,0 +1,17 @@ +import { setThemeCookie } from '@marketdataapp/ui/theme'; + +const observer = new MutationObserver((mutations) => { + for (const mutation of mutations) { + if (mutation.attributeName === 'data-theme') { + const theme = document.documentElement.getAttribute('data-theme'); + if (theme === 'dark' || theme === 'light') { + setThemeCookie(theme); + } + } + } +}); + +observer.observe(document.documentElement, { + attributes: true, + attributeFilter: ['data-theme'], +}); diff --git a/yarn.lock b/yarn.lock index f8cc670d..75d75845 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1581,6 +1581,10 @@ resolved "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz" integrity sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A== +"@marketdataapp/ui@github:MarketDataApp/ui": + version "1.1.0" + resolved "https://codeload.github.com/MarketDataApp/ui/tar.gz/d83dfd362a12e3173f02eb2c31eb43f4a7379fed" + "@mdx-js/mdx@^3.0.0": version "3.0.0" resolved "https://registry.npmjs.org/@mdx-js/mdx/-/mdx-3.0.0.tgz" From b81e44243304a01cf84b977245d7abb49f66c3b2 Mon Sep 17 00:00:00 2001 From: MarketDataApp Date: Mon, 2 Mar 2026 15:15:25 -0300 Subject: [PATCH 3/3] fix: guard MutationObserver behind SSR check Wrap MutationObserver in ExecutionEnvironment.canUseDOM to prevent ReferenceError during Docusaurus server-side rendering. --- src/clientModules/themeCookieSync.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/clientModules/themeCookieSync.js b/src/clientModules/themeCookieSync.js index 46473798..98787ce7 100644 --- a/src/clientModules/themeCookieSync.js +++ b/src/clientModules/themeCookieSync.js @@ -1,17 +1,20 @@ import { setThemeCookie } from '@marketdataapp/ui/theme'; +import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment'; -const observer = new MutationObserver((mutations) => { - for (const mutation of mutations) { - if (mutation.attributeName === 'data-theme') { - const theme = document.documentElement.getAttribute('data-theme'); - if (theme === 'dark' || theme === 'light') { - setThemeCookie(theme); +if (ExecutionEnvironment.canUseDOM) { + const observer = new MutationObserver((mutations) => { + for (const mutation of mutations) { + if (mutation.attributeName === 'data-theme') { + const theme = document.documentElement.getAttribute('data-theme'); + if (theme === 'dark' || theme === 'light') { + setThemeCookie(theme); + } } } - } -}); + }); -observer.observe(document.documentElement, { - attributes: true, - attributeFilter: ['data-theme'], -}); + observer.observe(document.documentElement, { + attributes: true, + attributeFilter: ['data-theme'], + }); +}