You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This way, when the route changes, the document will be updated to the new one, automatically unsubscribing from the previous one and subscribing to the new one.
82
82
83
83
::: tip
84
-
If you can't use a `computed()`, use `shallowRef()`s instead of `ref()`s to store the data sources. This is because `shallowRef()` doesn't try to recursively observe the object it's given, which in the case of a Firebase data source, would be worse in terms of performance.
84
+
85
+
`contactSource` can either be a _getter_, a `computed()`, or a `ref()`. If you are using a `ref()`, make sure to use `shallowRef()` instead of `ref()` for better performance.
On top of that, VueFire also allows `null` as a value for the data source. This is useful when you want to start observing a document or collection later in the lifecycle of your component, or if you cannot computed a valid document path, e.g. when the user is not logged in:
99
+
100
+
<FirebaseExample>
101
+
102
+
```ts
103
+
const user =useCurrentUser()
104
+
const myContactList =useCollection(() =>
105
+
user.value
106
+
?// Firebase will error if a null value is passed to `collection()`
?// Firebase will error if a null value is passed to `dbRef()`
118
+
dbRef(db, 'users', user.value.id, 'contacts')
119
+
:// this will be considered as no data source
120
+
null
121
+
)
122
+
```
123
+
124
+
</FirebaseExample>
125
+
87
126
### Subscription state
88
127
89
128
All of the composables can also be destructured to access other useful data like _is the initial load still pending?_ or _did the subscription fail?_. You only need to destructure the returned value from the composables:
Copy file name to clipboardExpand all lines: docs/guide/ssr.md
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,7 @@
1
1
# Server Side Rendering (SSR)
2
2
3
-
> Manually doing Server Side Rendering can get really complex, it is recommended to use Nuxt. Read the [Nuxt guide](/nuxt/getting-started.md), most of the things are already configured for you.
4
-
5
-
::: warning
6
-
SSR support is still experimental. Please report any issues you find.
3
+
:::tip
4
+
Manually doing Server Side Rendering can get really complex, it is recommended to use Nuxt. Read the [Nuxt guide](/nuxt/getting-started.md), most of the things are already configured for you.
0 commit comments