@sirendesign/markup 1.0.3 → 1.0.4

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
@@ -37515,17 +37515,20 @@ const useFirebaseSync = () => {
37515
37515
 
37516
37516
  const MarkupWidget = ({ config: userConfig, }) => {
37517
37517
  var _a;
37518
- const { isOpen, setIsOpen, activeTab, setActiveTab, selectedFeedback, setSelectedFeedback, feedbackItems, addFeedbackItem, config, setConfig, reset, isAuthenticated, currentUser, } = useMarkupStore();
37519
- // Initialize Firebase BEFORE the sync hook runs (if config provided)
37520
- if ((userConfig === null || userConfig === void 0 ? void 0 : userConfig.firebaseConfig) && getApps().length === 0) {
37521
- try {
37522
- initializeFirebase(userConfig.firebaseConfig);
37523
- console.log('Firebase initialized from MarkupWidget config');
37524
- }
37525
- catch (error) {
37526
- console.error('Failed to initialize Firebase:', error);
37518
+ // Initialize Firebase BEFORE any hooks run (using useMemo ensures this happens first)
37519
+ useMemo(() => {
37520
+ if ((userConfig === null || userConfig === void 0 ? void 0 : userConfig.firebaseConfig) && getApps().length === 0) {
37521
+ try {
37522
+ initializeFirebase(userConfig.firebaseConfig);
37523
+ console.log('Firebase initialized from MarkupWidget config');
37524
+ }
37525
+ catch (error) {
37526
+ console.error('Failed to initialize Firebase:', error);
37527
+ }
37527
37528
  }
37528
- }
37529
+ return null;
37530
+ }, [userConfig === null || userConfig === void 0 ? void 0 : userConfig.firebaseConfig]);
37531
+ const { isOpen, setIsOpen, activeTab, setActiveTab, selectedFeedback, setSelectedFeedback, feedbackItems, addFeedbackItem, config, setConfig, reset, isAuthenticated, currentUser, } = useMarkupStore();
37529
37532
  // Initialize Firebase sync
37530
37533
  useFirebaseSync();
37531
37534
  require$$0.useEffect(() => {