Skip to content

fix: initialization fails in non-browser environment that doesn't support indexedDB #1569

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
Oct 13, 2022

Conversation

dplewis
Copy link
Member

@dplewis dplewis commented Oct 8, 2022

New Pull Request Checklist

Issue Description

IndexedDB is only available in the browser. createStore is a promise that runs in the background. If indexedDB isn't supported, the promise rejects with Unhandled promise rejection.

Closes: #1552, #1440, #1505, #1441

Approach

  • Add indexedDBStorageController for process.env.PARSE_BUILD === 'browser'
  • Check if indexedDB exists

TODOs before merging

  • Add tests

@parse-github-assistant
Copy link

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant bot changed the title fix: Can't find variable: indexedDB fix: can't find variable: indexedDB Oct 8, 2022
@parse-github-assistant
Copy link

parse-github-assistant bot commented Oct 8, 2022

Thanks for opening this pull request!

  • ❌ Please link an issue that describes the reason for this pull request, otherwise your pull request will be closed. Make sure to write it as Related issue: #123 in the PR description, so I can recognize it.

@codecov
Copy link

codecov bot commented Oct 8, 2022

Codecov Report

Base: 99.93% // Head: 99.93% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (ccaf4ae) compared to base (2712e41).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##            alpha    #1569   +/-   ##
=======================================
  Coverage   99.93%   99.93%           
=======================================
  Files          61       61           
  Lines        5963     5965    +2     
  Branches     1362     1364    +2     
=======================================
+ Hits         5959     5961    +2     
  Misses          4        4           
Impacted Files Coverage Δ
src/IndexedDBStorageController.js 100.00% <100.00%> (ø)
src/Parse.js 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mtrezza
Copy link
Member

mtrezza commented Oct 8, 2022

@dplewis thanks for the PR; please request review from @parse-community/js-sdk-review instead of individual members, check the boxes at the top and remove TODOs that don’t apply in the template

@mtrezza mtrezza requested review from a team and removed request for davimacedo, dblythy and mtrezza October 8, 2022 06:18
@mtrezza mtrezza changed the title fix: can't find variable: indexedDB fix: initialization fails in non-browser environment that doesn't support indexedDB Oct 12, 2022
@mtrezza
Copy link
Member

mtrezza commented Oct 12, 2022

Is the PR title accurate?

@dplewis
Copy link
Member Author

dplewis commented Oct 12, 2022

Looks good!

@mtrezza mtrezza merged commit 3560a5e into parse-community:alpha Oct 13, 2022
parseplatformorg pushed a commit that referenced this pull request Oct 13, 2022
# [3.5.0-alpha.6](3.5.0-alpha.5...3.5.0-alpha.6) (2022-10-13)

### Bug Fixes

* initialization fails in non-browser environment that doesn't support `indexedDB` ([#1569](#1569)) ([3560a5e](3560a5e))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 3.5.0-alpha.6

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Oct 13, 2022
@dplewis dplewis deleted the fix-indexeddb branch October 14, 2022 01:16
parseplatformorg pushed a commit that referenced this pull request Oct 25, 2022
# [3.5.0-beta.1](3.4.4...3.5.0-beta.1) (2022-10-25)

### Bug Fixes

* `Parse.User.signUp()` does not pass context to Cloud Code  ([#1527](#1527)) ([53edcfd](53edcfd))
* `Schema.addField` does not correctly add value of type `Date` ([#1544](#1544)) ([15111f7](15111f7))
* creating a Parse.File with base64 string fails for some encodings ([#1517](#1517)) ([0439862](0439862))
* initialization fails in non-browser environment that doesn't support `indexedDB` ([#1569](#1569)) ([3560a5e](3560a5e))
* remove base64 validation due to validation inefficiency ([#1543](#1543)) ([473949d](473949d))

### Features

* add `json` option to `Parse.Query.each()` ([#1539](#1539)) ([89fd5ec](89fd5ec))
* add json option to query.each ([299fb0d](299fb0d))
* generate `Parse.Object.objectId` automatically when `allowCustomObjectId` is enabled and no `objectId` is passed ([#1540](#1540)) ([68f3ff5](68f3ff5))
* localDatastore support for unsorted distance queries ([#1570](#1570)) ([ea3e75f](ea3e75f))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 3.5.0-beta.1

@parseplatformorg parseplatformorg added the state:released-beta Released as beta version label Oct 25, 2022
parseplatformorg pushed a commit that referenced this pull request Nov 1, 2022
# [3.5.0](3.4.4...3.5.0) (2022-11-01)

### Bug Fixes

* `Parse.User.signUp()` does not pass context to Cloud Code  ([#1527](#1527)) ([53edcfd](53edcfd))
* `Schema.addField` does not correctly add value of type `Date` ([#1544](#1544)) ([15111f7](15111f7))
* creating a Parse.File with base64 string fails for some encodings ([#1517](#1517)) ([0439862](0439862))
* initialization fails in non-browser environment that doesn't support `indexedDB` ([#1569](#1569)) ([3560a5e](3560a5e))
* remove base64 validation due to validation inefficiency ([#1543](#1543)) ([473949d](473949d))

### Features

* add `json` option to `Parse.Query.each()` ([#1539](#1539)) ([89fd5ec](89fd5ec))
* add json option to query.each ([299fb0d](299fb0d))
* generate `Parse.Object.objectId` automatically when `allowCustomObjectId` is enabled and no `objectId` is passed ([#1540](#1540)) ([68f3ff5](68f3ff5))
* localDatastore support for unsorted distance queries ([#1570](#1570)) ([ea3e75f](ea3e75f))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 3.5.0

@parseplatformorg parseplatformorg added the state:released Released as stable version label Nov 1, 2022
mtrezza pushed a commit that referenced this pull request Nov 3, 2022
* `Parse.User.signUp()` does not pass context to Cloud Code  ([#1527](#1527)) ([53edcfd](53edcfd))
* `Schema.addField` does not correctly add value of type `Date` ([#1544](#1544)) ([15111f7](15111f7))
* creating a Parse.File with base64 string fails for some encodings ([#1517](#1517)) ([0439862](0439862))
* initialization fails in non-browser environment that doesn't support `indexedDB` ([#1569](#1569)) ([3560a5e](3560a5e))
* remove base64 validation due to validation inefficiency ([#1543](#1543)) ([473949d](473949d))

* add `json` option to `Parse.Query.each()` ([#1539](#1539)) ([89fd5ec](89fd5ec))
* add json option to query.each ([299fb0d](299fb0d))
* generate `Parse.Object.objectId` automatically when `allowCustomObjectId` is enabled and no `objectId` is passed ([#1540](#1540)) ([68f3ff5](68f3ff5))
* localDatastore support for unsorted distance queries ([#1570](#1570)) ([ea3e75f](ea3e75f))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version state:released-alpha Released as alpha version state:released-beta Released as beta version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unhandled promise rejection: ReferenceError: Can't find variable: indexedDB
4 participants