File tree Expand file tree Collapse file tree 9 files changed +112
-18
lines changed Expand file tree Collapse file tree 9 files changed +112
-18
lines changed Original file line number Diff line number Diff line change 1515 "comma-dangle": [
1616 "error",
1717 "always-multiline"
18- ]
18+ ],
19+ "vue/require-v-for-key": "off",
1920 }
2021}
Original file line number Diff line number Diff line change 1010 "require" : " ./dist/module.cjs"
1111 }
1212 },
13- "main" : " ./dist/module.cjs " ,
13+ "main" : " ./dist/module.mjs " ,
1414 "types" : " ./dist/types.d.ts" ,
1515 "files" : [
1616 " dist"
2727 "dev:prepare" : " nuxt-module-build --stub && nuxi prepare playground"
2828 },
2929 "dependencies" : {
30- "@nuxt/kit" : " 3.0.0-rc.13"
30+ "@nuxt/kit" : " ^ 3.0.0-rc.13"
3131 },
3232 "devDependencies" : {
3333 "@firebase/app-types" : " ^0.8.1" ,
3434 "@nuxt/module-builder" : " ^0.2.0" ,
35- "@nuxt/schema" : " 3.0.0-rc.13" ,
35+ "@nuxt/schema" : " ^ 3.0.0-rc.13" ,
3636 "@nuxtjs/eslint-config-typescript" : " ^11.0.0" ,
3737 "eslint" : " ^8.27.0" ,
3838 "firebase" : " ^9.14.0" ,
39- "nuxt" : " ^3.0.0-rc.12" ,
39+ "nuxt" : " ^^ 3.0.0-rc.12" ,
4040 "vuefire" : " workspace:*"
4141 }
4242}
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ const router = useRouter()
33
44const routes = router
55 .getRoutes ()
6- .filter (( record ) => record .path .startsWith (' /database/' ))
6+ .filter (record => record .path .startsWith (' /database/' ))
77 .map ((record ) => {
88 return {
99 name: record .name ,
@@ -14,10 +14,14 @@ const routes = router
1414
1515<template >
1616 <div >
17- <NuxtLink to =" /" >< ;< ; Back Home</NuxtLink >
17+ <NuxtLink to =" /" >
18+ < ;< ; Back Home
19+ </NuxtLink >
1820 <ul >
1921 <li v-for =" link in routes" >
20- <NuxtLink :to =" link" >{{ link.path }}</NuxtLink >
22+ <NuxtLink :to =" link" >
23+ {{ link.path }}
24+ </NuxtLink >
2125 </li >
2226 </ul >
2327 </div >
Original file line number Diff line number Diff line change 1+ <script setup lang="ts">
2+ import { doc , getDoc } from ' firebase/firestore'
3+ import { useDocument , useFirestore , usePendingPromises } from ' vuefire'
4+ import { ref } from ' vue'
5+
6+ const db = useFirestore ()
7+ const configRef = doc (db , ' configs' , ' jORwjIykFo2NmkdzTkhU' )
8+ // const itemRef = doc(db, 'tests', 'item')
9+ const isDoneFetching = ref (false )
10+ const isAllDoneFetching = ref (false )
11+
12+ getDoc (configRef ).then ((data ) => {
13+ console .log (' got data once' , data )
14+ })
15+
16+ const { data : config, promise } = useDocument (configRef , { wait: true })
17+ // const { data: hey } = useDocument(configRef)
18+
19+ promise .value .then ((data ) => {
20+ console .log (' one' , data )
21+ isDoneFetching .value = true
22+ })
23+
24+ usePendingPromises ().then ((data ) => {
25+ console .log (data )
26+ isAllDoneFetching .value = true
27+ })
28+ </script >
29+
30+ <template >
31+ <div >
32+ <p >config:</p >
33+ <p >finished: {{ isDoneFetching }}</p >
34+ <p >All finished: {{ isAllDoneFetching }}</p >
35+ <pre >{{ config }}</pre >
36+ </div >
37+ </template >
Original file line number Diff line number Diff line change 1+ <script lang="ts" setup>
2+ const router = useRouter ()
3+
4+ const routes = router
5+ .getRoutes ()
6+ .filter (record => record .path .startsWith (' /firestore/' ))
7+ .map ((record ) => {
8+ return {
9+ name: record .name ,
10+ path: record .path ,
11+ }
12+ })
13+ </script >
14+
15+ <template >
16+ <div >
17+ <NuxtLink to =" /" >
18+ < ;< ; Back Home
19+ </NuxtLink >
20+ <ul >
21+ <li v-for =" link in routes" >
22+ <NuxtLink :to =" link" >
23+ {{ link.path }}
24+ </NuxtLink >
25+ </li >
26+ </ul >
27+ </div >
28+ </template >
Original file line number Diff line number Diff line change 22 <div >
33 <ul >
44 <li >
5- <NuxtLink to =" /database" >Database</NuxtLink >
5+ <NuxtLink to =" /database" >
6+ Database
7+ </NuxtLink >
8+ </li >
9+ <li >
10+ <NuxtLink to =" /firestore" >
11+ Firestore
12+ </NuxtLink >
613 </li >
714 </ul >
815 </div >
Original file line number Diff line number Diff line change 11import { fileURLToPath } from 'node:url'
22import { resolve } from 'path'
33import { addPlugin , defineNuxtModule } from '@nuxt/kit'
4- import { FirebaseOptions } from '@firebase/app-types'
4+ import { type FirebaseOptions } from '@firebase/app-types'
55
66export interface VueFireNuxtModuleOptions {
77 optionsApiPlugin : boolean
Original file line number Diff line number Diff line change 1- import { defineNuxtPlugin } from '#app'
1+ import { usePendingPromises , VueFire , useSSRInitialState } from 'vuefire'
2+ import { initializeApp } from 'firebase/app'
3+ import { defineNuxtPlugin } from '#imports'
24
35export default defineNuxtPlugin ( async ( nuxtApp ) => {
4- // TODO: create the plugin that stores the promises with data
6+ // TODO: initialize firebase app from config
7+ const firebaseApp = initializeApp ( )
58
6- if ( process . server ) {
7- await 2 // TODO: wait for promises to resolve
9+ nuxtApp . vueApp . use (
10+ // @ts -expect-error: nuxt type bug?
11+ VueFire ,
12+ {
13+ firebaseApp,
14+ }
15+ )
816
9- // nuxtApp.payload.firebaseState = ...
10- } else {
11- // hydrate the plugin state from nuxtApp.payload.firebaseState
17+ if ( process . server ) {
18+ await usePendingPromises ( )
19+ // TODO: pass the firebaseApp
20+ nuxtApp . payload . vuefire = useSSRInitialState ( )
21+ } else if ( nuxtApp . payload ?. vuefire ) {
22+ // hydrate the plugin state from nuxtApp.payload.vuefire
23+ useSSRInitialState ( nuxtApp . payload . vuefire )
1224 }
1325
1426 return {
Original file line number Diff line number Diff line change 11{
2- "extends" : " ./playground/.nuxt/tsconfig.json"
2+ "extends" : " ./playground/.nuxt/tsconfig.json" ,
3+ "include" : [
4+ // missing in the playground
5+ " ./src"
6+ , " ./playground"
7+ ]
38}
You can’t perform that action at this time.
0 commit comments