@propknot/shared-ui 1.0.23 → 1.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1590,10 +1590,17 @@ var CustomThemeProvider = ({ children }) => {
1590
1590
  const canModifyTheme = Boolean(user && (user.role === "super_admin" || user.role === "admin" || user.role === "owner" || user.role === "property_manager" || user.role === "maintenance"));
1591
1591
  (0, import_react3.useEffect)(() => {
1592
1592
  if (!isEmbedded) return;
1593
+ let isInitialRequest = true;
1593
1594
  const handleMessage = (event) => {
1594
1595
  if (!event.origin.startsWith("http://localhost:")) return;
1595
1596
  const { type, theme } = event.data;
1596
1597
  if (type === "THEME_CHANGE" && theme && ["light", "dark"].includes(theme)) {
1598
+ const storedTheme2 = localStorage.getItem("embedded-theme");
1599
+ if (isInitialRequest && storedTheme2 && storedTheme2 !== theme) {
1600
+ isInitialRequest = false;
1601
+ return;
1602
+ }
1603
+ isInitialRequest = false;
1597
1604
  setCurrentTheme(theme);
1598
1605
  localStorage.setItem("embedded-theme", theme);
1599
1606
  }