-
Notifications
You must be signed in to change notification settings - Fork 112
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
Breaking out un-related changes from #1487 #1670
Changes from 9 commits
5baff60
19ae829
91ddbc7
10294cc
96ea932
84a821e
2f66a5b
316ede0
a15be19
e733bff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ export class Database { | |
/** | ||
* @param {string} databaseName | ||
* @param {number} version | ||
* @param {import('database').StructureDefinition<TObjectStoreName>[]} structure | ||
* @param {import('database').StructureDefinition<TObjectStoreName>[]?} structure | ||
*/ | ||
async open(databaseName, version, structure) { | ||
if (this._db !== null) { | ||
|
@@ -43,7 +43,9 @@ export class Database { | |
try { | ||
this._isOpening = true; | ||
this._db = await this._open(databaseName, version, (db, transaction, oldVersion) => { | ||
this._upgrade(db, transaction, oldVersion, structure); | ||
if (structure !== null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be part of the main PR There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems like a guard clause added for type-safety and not really related to the main PR There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, the PR makes this field nullable so that we can have workers that interact with the DB but don't upgrade it. It's a logic change. |
||
this._upgrade(db, transaction, oldVersion, structure); | ||
} | ||
}); | ||
} finally { | ||
this._isOpening = false; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this shouldn't be here? I like having files formatted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The files are still formatted, just by eslint instead of vscode's formatter. Previously they would both run and conflict and cause all sorts of issues.