Skip to content
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

custom serializer causes Maximum call stack size exceeded error if the document contains a reference firestore.DocumentSnapshot #989

Closed
wujekbogdan opened this issue Jan 8, 2021 · 1 comment

Comments

@wujekbogdan
Copy link
Contributor

wujekbogdan commented Jan 8, 2021

Reproduction

Define a serializer that returns an object containing a reference to firestore.DocumentSnapshot

bindFirestoreRef('boundRef', ref, {
  maxRefDepth : 0,
  serialize: (snap) => ({
    ...snap.data(),
    id: snap.id,
    snap,
  }),
});

Expected behavior

I would expect maxRefDepth : 0 to prevent vuexfire from binding nested document snapshots

Actual behavior

I'm getting Uncaught RangeError: Maximum call stack size exceeded

Additional information

I found a workaround:

bindFirestoreRef('boundRef', ref, {
  serialize: (snap) =>
    Object.defineProperty(
      {
        ...snap.data(),
        id: snap.id,
      },
      'snap',
      {
        configurable: false,
        value: snap,
      }
    ),
});
@wujekbogdan
Copy link
Contributor Author

It turned out that I wasn't a bug in vuexfire. It was a bug in Firebase (firebase/firebase-js-sdk#4258) that's fixed in the 8.2.5 release.

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

1 participant