Skip to content

Commit e87db35

Browse files
committed
Add docs for preventing Nuxt memory leak
Closes #378
1 parent d6b179f commit e87db35

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

docs/api-overview.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ build: {
112112
}
113113
```
114114

115+
Be sure to read the section of the docs dedicated to [Working With Nuxt](./nuxt.md).
116+
115117
## Vue DevTools
116118

117119
Since Feathers-Vuex extensively uses Vuex under the hood, you'll want to make sure your VueJS developer tools are up to date AND setup properly. Specifically, the "New Vuex Backend" needs to be enabled. To setup the devtools

docs/nuxt.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22
title: Nuxt
33
---
44

5+
# Nuxt
6+
7+
## Preventing Memory Leaks
8+
9+
The default settings of Feathers-Vuex include having realtime events enabled by default. This will result in increased memory usage over time on the SSR server. It can be turned off when you configure `feathers-vuex`. The example below has been modified from the example of [Setting up the Feathers Client & Feathers-Vuex](./api-overview.md#feathers-client-feathers-vuex). Look specifically at the `enableEvents` option.
10+
11+
```js
12+
const { makeServicePlugin, makeAuthPlugin, BaseModel, models, FeathersVuex } = feathersVuex(
13+
feathersClient,
14+
{
15+
serverAlias: 'api',
16+
idField: '_id',
17+
whitelist: ['$regex', '$options'],
18+
enableEvents: process.client // No events for SSR server
19+
}
20+
)
21+
```
22+
523
## Working with Auth & Nuxt
624

725
`[email protected]^` ships with utilities that help with Nuxt auth related to JSON Web Tokens (JWT). The most important utility is the `initAuth` utility. It's for use during Nuxt's `nuxtServerInit` method, and sets up auth data automatically.

0 commit comments

Comments
 (0)