Skip to content

Commit c4eb143

Browse files
committed
feat(database): once on server
1 parent 20b7e6d commit c4eb143

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/database/index.ts

+7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from 'vue-demi'
1414
import { DatabaseReference, getDatabase, Query } from 'firebase/database'
1515
import {
16+
isSSR,
1617
noop,
1718
OperationsType,
1819
ResetOption,
@@ -56,6 +57,12 @@ export function _useDatabaseRef(
5657
) {
5758
let unbind!: UnbindWithReset
5859
const options = Object.assign({}, databaseOptionsDefaults, localOptions)
60+
61+
// During SSR, we should only get data once
62+
if (isSSR()) {
63+
options.once = true
64+
}
65+
5966
const initialSourceValue = unref(reference)
6067

6168
const data = options.target || ref<unknown | null>()

0 commit comments

Comments
 (0)