@sirendesign/markup 1.0.4 → 1.0.5

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.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
- import require$$0, { useRef, useState, useEffect, useCallback, useMemo as useMemo$1 } from 'react';
3
+ import require$$0, { useRef, useState, useEffect, useCallback, useMemo } from 'react';
4
4
  import { createPortal } from 'react-dom';
5
5
 
6
6
  const createStoreImpl = (createState) => {
@@ -11936,7 +11936,7 @@ const FeedbackList = ({ feedbackItems, onSelectFeedback, }) => {
11936
11936
  const { config } = useMarkupStore();
11937
11937
  const [statusFilter, setStatusFilter] = useState("all");
11938
11938
  const [sortBy, setSortBy] = useState("newest");
11939
- const filteredAndSortedItems = useMemo$1(() => {
11939
+ const filteredAndSortedItems = useMemo(() => {
11940
11940
  let items = [...feedbackItems];
11941
11941
  // Filter by status
11942
11942
  if (statusFilter !== "all") {
@@ -37511,19 +37511,18 @@ const useFirebaseSync = () => {
37511
37511
 
37512
37512
  const MarkupWidget = ({ config: userConfig, }) => {
37513
37513
  var _a;
37514
- // Initialize Firebase BEFORE any hooks run (using useMemo ensures this happens first)
37515
- useMemo(() => {
37516
- if ((userConfig === null || userConfig === void 0 ? void 0 : userConfig.firebaseConfig) && getApps().length === 0) {
37517
- try {
37518
- initializeFirebase(userConfig.firebaseConfig);
37519
- console.log('Firebase initialized from MarkupWidget config');
37520
- }
37521
- catch (error) {
37522
- console.error('Failed to initialize Firebase:', error);
37523
- }
37514
+ // Initialize Firebase synchronously on first render only
37515
+ const initRef = useRef(false);
37516
+ if (!initRef.current && (userConfig === null || userConfig === void 0 ? void 0 : userConfig.firebaseConfig) && getApps().length === 0) {
37517
+ try {
37518
+ initializeFirebase(userConfig.firebaseConfig);
37519
+ console.log('Firebase initialized from MarkupWidget config');
37520
+ initRef.current = true;
37524
37521
  }
37525
- return null;
37526
- }, [userConfig === null || userConfig === void 0 ? void 0 : userConfig.firebaseConfig]);
37522
+ catch (error) {
37523
+ console.error('Failed to initialize Firebase:', error);
37524
+ }
37525
+ }
37527
37526
  const { isOpen, setIsOpen, activeTab, setActiveTab, selectedFeedback, setSelectedFeedback, feedbackItems, addFeedbackItem, config, setConfig, reset, isAuthenticated, currentUser, } = useMarkupStore();
37528
37527
  // Initialize Firebase sync
37529
37528
  useFirebaseSync();