Skip to content

[docs] need info on garbage collection #2030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
larssn opened this issue Mar 22, 2019 · 1 comment
Closed

[docs] need info on garbage collection #2030

larssn opened this issue Mar 22, 2019 · 1 comment

Comments

@larssn
Copy link
Contributor

larssn commented Mar 22, 2019

Just a small request to update the docs on how to enable garbage collection, which pretty much is a necessity on IndexedDB databased in order to stay performant.

I dug through the code, and I think the below approach is the way to do it, but correct me if I'm wrong on that.

This is how we've done it:

app.module.ts

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    AngularFireModule.initializeApp({ ... }),
    AngularFireAuthModule,
    AngularFireDatabaseModule,
    AngularFirestoreModule,
    ...
  ],
  providers: [
    FirebaseApp,
    {
      provide: FirestoreSettingsToken, useValue: <Settings>{
        timestampsInSnapshots: undefined,
        cacheSizeBytes: 5 * 1024 * 1024, // 5MB
      }
    },
    { provide: EnablePersistenceToken, useValue: true },
  ],
  bootstrap: [AppComponent],
})
export class AppModule { }

If this is the correct way of doing it, I'll gladly do a PR to update the relevant docs.

@jamesdaniels
Copy link
Member

Feel free to send something in a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants