Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

useFirestore breaks the app when used in a function in the utils folder and the page is refreshed (nuxt)#1567

Unanswered
StefanGhiban asked this question inQuestions and Help
Discussion options

Reproduction

Steps to reproduce the bug

I have the following code in a file called "firestoreReferences.ts" in the nuxt utils folder:
import { collection } from "firebase/firestore";

const db = useFirestore();

export const restaurantsCollRef = collection(db, "restaurants");
export const bookingsCollRef = collection(db, "bookings");

Expected behavior

The references should be auto imported and used throughout the app with no issue.

Actual behavior

On page refresh, the app breaks with the following error: Firebase: No Firebase App '[DEFAULT]' has been created - call initializeApp() first (app/no-app).

If I just access the page, without refreshing, it works fine, but it is because maybe firebase has already loaded.

Additional information

Is this a bad practice? or is there a way to ensure firebase has loaded before using the useFirestore composable?

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Hi@StefanGhiban, could you resolve this problem? I have something similar that blocks me since quite a while...

You must be logged in to vote
1 reply
@D4rkMindz
Comment options

I created an issue#1588 (which was then routed to the discussion#1589) for this problem

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
None yet
2 participants
@StefanGhiban@D4rkMindz
Converted from issue

This discussion was converted from issue #1566 on August 16, 2024 16:41.


[8]ページ先頭

©2009-2025 Movatter.jp