Skip to content

Conversation

tobias74
Copy link

Description

In some cases (especially when frequently subscribing and unsubscribing geo queries) there was an error:

Uncaught ReferenceError: Cannot access 'valueUnsubscribe' before initialization
at GeoQuery.ts:485:37

It seems that in those cases the callback provided to onValue was called synchronously before returning valueUnsubscribe from the function call. Therefore valueUnsubscribe was not yet fully defined (Temporal Dead Zone ?)

@tobias74
Copy link
Author

tobias74 commented Oct 26, 2024

I have just looked into the docs for onValue: it returns an unsubscribe function. So my question is: Does this implementation:

off(firebaseQuery, 'value', valueUnsubscribe);

really unsubscribe correctly? Shouldn't it just be:

valueUnsubscribe();

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

Successfully merging this pull request may close these issues.

1 participant