-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
Store remembered device, discovery, accounts, txs in db #713
Conversation
…ite into remember-device-storage
@@ -251,6 +289,26 @@ class CommonDB<TDBStructure> { | |||
const items = await tx.store.getAll(); | |||
return items; |
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.
return tx.store.getAll()
?
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.
and the same in line 285 and 220
@@ -290,6 +328,26 @@ class CommonDB<TDBStructure> { | |||
const items = await tx.store.getAll(); |
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.
same as native/index:
return tx.store.getAll() ?
newVersion: number | null, | ||
transaction: any | ||
) => void; | ||
db: OnUpgradeProps<TDBStructure>['db'], |
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.
wouldn't be cleaner to declare this function once?
Since you are using it here and then the same declaration in constructor?
case DISCOVERY.STOP: | ||
case DISCOVERY.COMPLETE: { | ||
// TODO: explore better way to update discovery only | ||
const device = api.getState().devices.find(d => d.state === action.payload.deviceState); |
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.
you can use getState().suite.device
instead, discovery is designed to run only on currently selected device
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.
wait :) i don't get why you are saving device instead of discovery?
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.
rememberDevice
should be triggered from SUITE.REMEMBER_DEVICE
, right?
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.
- additionaly device should be updated after DEVICE.UPDATE as well, for example changing label/FW/pin/passphrase settings
fix #745
part of #8 (web/electron covered)