Skip to content

Backport Android updateTransform changes #4225

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 4 commits into from
Jan 7, 2021

Conversation

thebrianchen
Copy link

@thebrianchen thebrianchen commented Dec 18, 2020

After porting update transforms to Android, I found some changes that needed to be ported back. I also replaced usages of TransformMutation.

@changeset-bot
Copy link

changeset-bot bot commented Dec 18, 2020

⚠️ No Changeset found

Latest commit: 8321655

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Dec 18, 2020

Changeset File Check ⚠️

  • Changeset formatting error in following file:
    Package "@firebase/messaging-exp" must depend on the current version of "@firebase/util": "0.3.4" vs "0.3.2"
    { ValidationError: Some errors occurred when validating the changesets config:
    The package "@firebase/messaging-exp" depends on the ignored package "@firebase/app-exp", but "@firebase/messaging-exp" is not being ignored. Please add "@firebase/messaging-exp" to the `ignore` option.
    The package "@firebase/messaging-exp" depends on the ignored package "@firebase/app-types-exp", but "@firebase/messaging-exp" is not being ignored. Please add "@firebase/messaging-exp" to the `ignore` option.
    The package "@firebase/messaging-exp" depends on the ignored package "@firebase/installations-exp", but "@firebase/messaging-exp" is not being ignored. Please add "@firebase/messaging-exp" to the `ignore` option.
      name: 'ValidationError',
      _error:
       Error
           at new ExtendableError (/home/runner/work/firebase-js-sdk/firebase-js-sdk/node_modules/extendable-error/bld/index.js:23:24)
           at new ValidationError (/home/runner/work/firebase-js-sdk/firebase-js-sdk/node_modules/@changesets/errors/dist/errors.cjs.dev.js:16:1)
           at parse (/home/runner/work/firebase-js-sdk/firebase-js-sdk/node_modules/@changesets/cli/node_modules/@changesets/config/dist/config.cjs.dev.js:196:11)
           at Object.read (/home/runner/work/firebase-js-sdk/firebase-js-sdk/node_modules/@changesets/cli/node_modules/@changesets/config/dist/config.cjs.dev.js:84:10) }
    

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Dec 18, 2020

Size Analysis Report

Affected Products

@firebase/messaging-exp

  • deleteToken

    Size

    Type Base (1a8cb40) Head (d1917c2) Diff
    size ? 7.52 kB ? (?)
    size_with_ext_deps ? 24.9 kB ? (?)

    Dependencies

    Type Base (1a8cb40) Head (d1917c2) Diff
    functions ?
    Click to show 20 depsarrayToBase64
    checkTokenDetails
    dbGet
    dbRemove
    dbSet
    deleteToken
    deleteTokenInternal
    extractAppConfig
    getDbPromise
    getEndpoint
    getHeaders
    getKey
    getMissingValueError
    isSWControllerSupported
    isSupported
    isWindowControllerSupported
    migrateOldDatabase
    registerDefaultSw
    registerMessaging
    requestDeleteToken
    ?
    classes ? MessagingService ?
    variables ?
    Click to show 14 depsDATABASE_NAME
    DATABASE_VERSION
    DEFAULT_SW_PATH
    DEFAULT_SW_SCOPE
    ENDPOINT
    ERROR_FACTORY
    ERROR_MAP
    MessageType
    OBJECT_STORE_NAME
    OLD_DB_NAME
    OLD_DB_VERSION
    OLD_OBJECT_STORE_NAME
    dbPromise
    messagingFactory
    ?

    External Dependencies

    Module Base (1a8cb40) Head (d1917c2) Diff
    @firebase/util ? ErrorFactory ?
    idb ? deleteDb
    openDb
    ?
    @firebase/installations-exp ? getToken ?
    @firebase/app-exp ? _registerComponent ?
    @firebase/component ? Component ?
  • getMessaging

    Size

    Type Base (1a8cb40) Head (d1917c2) Diff
    size ? 3.67 kB ? (?)
    size_with_ext_deps ? 21.0 kB ? (?)

    Dependencies

    Type Base (1a8cb40) Head (d1917c2) Diff
    functions ?
    Click to show 7 depsextractAppConfig
    getMessaging
    getMissingValueError
    isSWControllerSupported
    isSupported
    isWindowControllerSupported
    registerMessaging
    ?
    classes ? MessagingService ?
    variables ? ERROR_FACTORY
    ERROR_MAP
    MessageType
    messagingFactory
    ?

    External Dependencies

    Module Base (1a8cb40) Head (d1917c2) Diff
    @firebase/util ? ErrorFactory ?
    @firebase/app-exp ? _getProvider
    _registerComponent
    ?
    @firebase/component ? Component ?
  • getToken

    Size

    Type Base (1a8cb40) Head (d1917c2) Diff
    size ? 12.0 kB ? (?)
    size_with_ext_deps ? 29.5 kB ? (?)

    Dependencies

    Type Base (1a8cb40) Head (d1917c2) Diff
    functions ?
    Click to show 39 depsarrayToBase64
    base64ToArray
    checkTokenDetails
    dbGet
    dbRemove
    dbSet
    deleteTokenInternal
    externalizePayload
    extractAppConfig
    getBody
    getDbPromise
    getEndpoint
    getEventType
    getHeaders
    getKey
    getMissingValueError
    getNewToken
    getPushSubscription
    getToken
    getTokenInternal
    isConsoleMessage
    isSWControllerSupported
    isSupported
    isTokenValid
    isWindowControllerSupported
    logToScion
    messageEventListener
    migrateOldDatabase
    propagateDataPayload
    propagateFcmOptions
    propagateNotificationPayload
    registerDefaultSw
    registerMessaging
    requestDeleteToken
    requestGetToken
    requestUpdateToken
    updateSwReg
    updateToken
    updateVapidKey
    ?
    classes ? MessagingService ?
    variables ?
    Click to show 20 depsCONSOLE_CAMPAIGN_ANALYTICS_ENABLED
    CONSOLE_CAMPAIGN_ID
    CONSOLE_CAMPAIGN_NAME
    CONSOLE_CAMPAIGN_TIME
    DATABASE_NAME
    DATABASE_VERSION
    DEFAULT_SW_PATH
    DEFAULT_SW_SCOPE
    DEFAULT_VAPID_KEY
    ENDPOINT
    ERROR_FACTORY
    ERROR_MAP
    MessageType
    OBJECT_STORE_NAME
    OLD_DB_NAME
    OLD_DB_VERSION
    OLD_OBJECT_STORE_NAME
    TOKEN_EXPIRATION_MS
    dbPromise
    messagingFactory
    ?

    External Dependencies

    Module Base (1a8cb40) Head (d1917c2) Diff
    @firebase/util ? ErrorFactory ?
    idb ? deleteDb
    openDb
    ?
    @firebase/installations-exp ? getToken ?
    @firebase/app-exp ? _registerComponent ?
    @firebase/component ? Component ?
  • onMessage

    Size

    Type Base (1a8cb40) Head (d1917c2) Diff
    size ? 5.19 kB ? (?)
    size_with_ext_deps ? 22.6 kB ? (?)

    Dependencies

    Type Base (1a8cb40) Head (d1917c2) Diff
    functions ?
    Click to show 15 depsexternalizePayload
    extractAppConfig
    getEventType
    getMissingValueError
    isConsoleMessage
    isSWControllerSupported
    isSupported
    isWindowControllerSupported
    logToScion
    messageEventListener
    onMessage
    propagateDataPayload
    propagateFcmOptions
    propagateNotificationPayload
    registerMessaging
    ?
    classes ? MessagingService ?
    variables ?
    Click to show 8 depsCONSOLE_CAMPAIGN_ANALYTICS_ENABLED
    CONSOLE_CAMPAIGN_ID
    CONSOLE_CAMPAIGN_NAME
    CONSOLE_CAMPAIGN_TIME
    ERROR_FACTORY
    ERROR_MAP
    MessageType
    messagingFactory
    ?

    External Dependencies

    Module Base (1a8cb40) Head (d1917c2) Diff
    @firebase/util ? ErrorFactory ?
    @firebase/app-exp ? _registerComponent ?
    @firebase/component ? Component ?

Test Logs

@@ -689,14 +675,6 @@ function localTransformResults(
previousValue = maybeDoc.field(fieldTransform.field);
}

if (previousValue === null && baseDoc instanceof Document) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this logic no longer needed? This seems pretty critical. Or is it handled elsewhere now?

Copy link
Author

@thebrianchen thebrianchen Dec 21, 2020

Choose a reason for hiding this comment

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

My understanding is that this if-statement checks for the edge case where a PatchMutation clears the values of a nested map before the TransformMutation is applied. With the addition of updateTransforms, field transformation are encoded directly on the Patch or Set Mutation, rather than in a separate TransformMutation. This means that we won't bump into this edge case anymore since the update and fieldTransform are on the same mutation and thus applied at the same time.

I've also removed the now obsolete server timestamp test that tested this edge case.

@wilhuff wilhuff assigned thebrianchen and unassigned wilhuff Dec 21, 2020
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

@wilhuff wilhuff assigned thebrianchen and unassigned wilhuff Jan 7, 2021
@thebrianchen thebrianchen merged commit db7dae7 into master Jan 7, 2021
@thebrianchen thebrianchen deleted the bc/fix-update-transforms branch January 7, 2021 04:16
@firebase firebase locked and limited conversation to collaborators Feb 7, 2021
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.

3 participants