Skip to content

Use explicit String constants for OnlineState #2688

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

Merged
merged 2 commits into from
Feb 27, 2020

Conversation

schmidt-sebastian
Copy link
Contributor

@Feiyang1 noticed in a sample app that multitab is not able to parse OnlineStates since the constants are rewritten to __PRIVATE_OnlineState:

@firebase/firestore: Firestore (7.9.1): SharedClientState Failed to parse online state: {"clientId":"Xnj51M6igYRWov1EHcwt","onlineState":"__PRIVATE_Unknown"}

This PR removes the enum usage for OnlineState, to make sure that the constant names are not mangled.

Multi-Tab uses the same concept for its other "enums":

['pending', 'acknowledged', 'rejected'].indexOf(mutationBatch.state) !==

As a guide, the size impact of this PR:

  • +7 bytes versus master (before GZIP)
  • -43 bytes versus master (after GZIP) WHEEE

Feiyang noticed in a sample app that multitab is not able to parse OnlineStates since the constants are rewritten to __PRIVATE_OnlineState. This PR removes the enum usage for OnlineState, to make sure that the Enum names are mangled.
Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This is fine as an intermediate state while we work out exactly how to address enums.

@wilhuff wilhuff assigned schmidt-sebastian and unassigned wilhuff Feb 27, 2020
@schmidt-sebastian schmidt-sebastian changed the title Use explicit String constanst for OnlineState Use explicit String constants for OnlineState Feb 27, 2020
@schmidt-sebastian schmidt-sebastian merged commit cb01df4 into master Feb 27, 2020
schmidt-sebastian added a commit that referenced this pull request Feb 28, 2020
@firebase firebase locked and limited conversation to collaborators Mar 29, 2020
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/onlinestate branch April 6, 2020 19:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants