Skip to content

fix: move firebase init outside component to prevent loops#61

Open
vibhutomer wants to merge 1 commit into
seetadev:mainfrom
vibhutomer:fix/firebase-init-loop
Open

fix: move firebase init outside component to prevent loops#61
vibhutomer wants to merge 1 commit into
seetadev:mainfrom
vibhutomer:fix/firebase-init-loop

Conversation

@vibhutomer
Copy link
Copy Markdown

Description of Changes

  • Moved the initFirebase() call from inside the Home functional component to the top-level module scope in Govt-Billing-React/src/pages/Home.tsx.
  • This ensures the Firebase app is initialized exactly once when the application loads, rather than on every state update or re-render.

Impact

  • Stability: Prevents the Firebase: Firebase App named '[DEFAULT]' already exists error.
  • Performance: Reduces unnecessary logic execution during the React component lifecycle.
  • Clean Code: Adheres to React best practices for side-effects and global initializations.

Testing Done

  • Verified that the application initializes correctly on startup.
  • Confirmed that UI interactions (menu toggles, file switching) no longer trigger re-initialization logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Firebase Re-initialization Loop

1 participant