Skip to content

Fix the ordering of the index-based lookup in getAll(keys) #6128

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 6 commits into from
Apr 12, 2022

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Apr 7, 2022

This changes the ordering we user for multi-key lookups to match that of IndexedDB.

Fixes #6110

@changeset-bot
Copy link

changeset-bot bot commented Apr 7, 2022

🦋 Changeset detected

Latest commit: 7c28b16

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@firebase/firestore Patch
firebase Patch
@firebase/firestore-compat Patch

Not sure what this means? Click here to learn what changesets are.

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

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Apr 7, 2022

Size Report 1

Affected Products

  • @firebase/database

    TypeBase (d756f4e)Merge (f5ab920)Diff
    browser247 kB247 kB+13 B (+0.0%)
    esm5275 kB275 kB+13 B (+0.0%)
    main280 kB280 kB+13 B (+0.0%)
    module247 kB247 kB+13 B (+0.0%)
  • @firebase/database-compat/standalone

    TypeBase (d756f4e)Merge (f5ab920)Diff
    main369 kB369 kB+13 B (+0.0%)
  • @firebase/firestore

    TypeBase (d756f4e)Merge (f5ab920)Diff
    browser252 kB252 kB+160 B (+0.1%)
    esm5313 kB313 kB+149 B (+0.0%)
    main503 kB503 kB+320 B (+0.1%)
    module252 kB252 kB+160 B (+0.1%)
    react-native252 kB252 kB+160 B (+0.1%)
  • @firebase/util

    TypeBase (d756f4e)Merge (f5ab920)Diff
    browser23.4 kB23.4 kB+11 B (+0.0%)
    esm525.5 kB25.5 kB+34 B (+0.1%)
    main30.5 kB30.6 kB+34 B (+0.1%)
    module23.4 kB23.4 kB+11 B (+0.0%)
  • bundle

    43 size changes

    TypeBase (d756f4e)Merge (f5ab920)Diff
    analytics (logEvent)40.0 kB40.0 kB+11 B (+0.0%)
    app-check (CustomProvider)33.7 kB33.7 kB+11 B (+0.0%)
    app-check (ReCaptchaEnterpriseProvider)35.9 kB35.9 kB+11 B (+0.0%)
    app-check (ReCaptchaV3Provider)35.8 kB35.9 kB+11 B (+0.0%)
    auth (Anonymous)63.5 kB63.5 kB+11 B (+0.0%)
    auth (EmailAndPassword)67.6 kB67.6 kB+11 B (+0.0%)
    auth (GoogleFBTwitterGitHubPopup)87.3 kB87.4 kB+11 B (+0.0%)
    auth (GooglePopup)87.1 kB87.1 kB+11 B (+0.0%)
    auth (GoogleRedirect)87.3 kB87.3 kB+11 B (+0.0%)
    auth (Phone)73.6 kB73.6 kB+11 B (+0.0%)
    database (Append to a list of data)143 kB144 kB+24 B (+0.0%)
    database (Filtering data)142 kB142 kB+24 B (+0.0%)
    database (Listen for child events)158 kB158 kB+24 B (+0.0%)
    database (Listen for value events + Detach listeners)158 kB158 kB+24 B (+0.0%)
    database (Listen for value events)158 kB158 kB+24 B (+0.0%)
    database (Read data once)150 kB150 kB+24 B (+0.0%)
    database (Save data as transactions)160 kB160 kB+24 B (+0.0%)
    database (Sort data)144 kB144 kB+24 B (+0.0%)
    database (Write data)143 kB143 kB+24 B (+0.0%)
    firestore (Persistence)262 kB262 kB+171 B (+0.1%)
    firestore (Query Cursors)202 kB202 kB+11 B (+0.0%)
    firestore (Query)203 kB203 kB+11 B (+0.0%)
    firestore (Read data once)192 kB192 kB+11 B (+0.0%)
    firestore (Realtime updates)194 kB194 kB+11 B (+0.0%)
    firestore (Transaction)176 kB176 kB+11 B (+0.0%)
    firestore (Write data)176 kB176 kB+11 B (+0.0%)
    firestore-lite (Query Cursors)66.3 kB66.3 kB+11 B (+0.0%)
    firestore-lite (Query)69.4 kB69.4 kB+11 B (+0.0%)
    firestore-lite (Read data once)53.8 kB53.9 kB+11 B (+0.0%)
    firestore-lite (Transaction)71.2 kB71.2 kB+11 B (+0.0%)
    firestore-lite (Write data)56.6 kB56.6 kB+11 B (+0.0%)
    functions (call)27.6 kB27.6 kB+11 B (+0.0%)
    messaging (send + receive)43.3 kB43.3 kB+11 B (+0.0%)
    performance (trace)47.7 kB47.7 kB+11 B (+0.0%)
    remote-config (getAndFetch)42.3 kB42.4 kB+11 B (+0.0%)
    storage (getBytes)35.9 kB35.9 kB+11 B (+0.0%)
    storage (getDownloadURL)38.0 kB38.0 kB+11 B (+0.0%)
    storage (getMetadata)37.4 kB37.5 kB+11 B (+0.0%)
    storage (list + listAll)36.9 kB36.9 kB+11 B (+0.0%)
    storage (updateMetadata)37.7 kB37.7 kB+11 B (+0.0%)
    storage (uploadBytes)42.2 kB42.3 kB+11 B (+0.0%)
    storage (uploadBytesResumable)51.7 kB51.7 kB+11 B (+0.0%)
    storage (uploadString)42.5 kB42.5 kB+11 B (+0.0%)

  • firebase

    19 size changes

    TypeBase (d756f4e)Merge (f5ab920)Diff
    firebase-analytics-compat.js24.3 kB24.3 kB+11 B (+0.0%)
    firebase-analytics.js105 kB105 kB+13 B (+0.0%)
    firebase-app-compat.js26.4 kB26.4 kB+11 B (+0.0%)
    firebase-app.js81.5 kB81.5 kB+13 B (+0.0%)
    firebase-auth-react-native.js492 kB492 kB+13 B (+0.0%)
    firebase-compat.js778 kB779 kB+185 B (+0.0%)
    firebase-database-compat.js165 kB165 kB+13 B (+0.0%)
    firebase-database.js603 kB603 kB+15 B (+0.0%)
    firebase-firestore-compat.js303 kB303 kB+161 B (+0.1%)
    firebase-firestore.js820 kB821 kB+420 B (+0.1%)
    firebase-messaging-compat.js36.4 kB36.4 kB+11 B (+0.0%)
    firebase-messaging-sw.js101 kB101 kB+13 B (+0.0%)
    firebase-messaging.js99.4 kB99.4 kB+13 B (+0.0%)
    firebase-performance-compat.js29.1 kB29.1 kB+11 B (+0.0%)
    firebase-performance-standalone-compat.es2017.js86.5 kB86.5 kB+11 B (+0.0%)
    firebase-performance-standalone-compat.js64.0 kB64.0 kB+24 B (+0.0%)
    firebase-performance.js117 kB117 kB+13 B (+0.0%)
    firebase-remote-config-compat.js25.8 kB25.8 kB+11 B (+0.0%)
    firebase-remote-config.js106 kB106 kB+13 B (+0.0%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/WzKLfepRBF.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Apr 7, 2022

Size Analysis Report 1

This report is too large (127,563 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/Q505rZ4aLR.html

}
}

return (
Copy link
Contributor

Choose a reason for hiding this comment

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

primitiveComparator returns number, not boolean..how this works is not obvious to me..

Can we make it more explicit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

JS compares by "thruhiness" and any non-null number is considered true. We could have something like:

let cmp = compare()
if (cmp) return cmp;

cmp = compare()
if (cmp) return cmp;

cmp = compare()
if (cmp) return cmp;

That was my original code but it is pretty bloated. Let me know what you prefer.

Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer the bloated way..

@wu-hui wu-hui assigned schmidt-sebastian and unassigned wu-hui Apr 11, 2022
}
}

return (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

JS compares by "thruhiness" and any non-null number is considered true. We could have something like:

let cmp = compare()
if (cmp) return cmp;

cmp = compare()
if (cmp) return cmp;

cmp = compare()
if (cmp) return cmp;

That was my original code but it is pretty bloated. Let me know what you prefer.

@schmidt-sebastian schmidt-sebastian merged commit 05dc9d6 into master Apr 12, 2022
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/rdcbug branch April 12, 2022 20:22
@google-oss-bot google-oss-bot mentioned this pull request Apr 12, 2022
@firebase firebase locked and limited conversation to collaborators May 13, 2022
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.

IndexedDB exception on Firestore batch.commit with latest Firebase SDK 9.6.10
3 participants