-
Notifications
You must be signed in to change notification settings - Fork 27
Add a DaybedStorage PoC #25
base: master
Are you sure you want to change the base?
Conversation
I used componentDidMount and it worked :) |
componentDidMount: function() { | ||
this.props.store.load() | ||
.then(function(items) { | ||
if (this.isMounted()) { |
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're in componentDidMount
, component is necessarily mounted.
for (var i = 0; i < doc.records.length; i++) { | ||
var record = doc.records[i]; | ||
record.type = type; | ||
data.push(record); |
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.
Nit:
data = doc.records.map(function(record) {
record.type = type;
return record;
});
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.
Well you don't want to override data at this point.
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.
But I can still use map 👍
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.
data = data.concat
then
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.
race condition detected with data.concat
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.
Well maybe not, let me try.
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'd be very surprised if concat would where a for loop wouldn't.
try { | ||
this._store["keep.data"] = JSON.stringify(data); | ||
} catch (e) { | ||
console.error("failed saving keep data", e); |
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.
call reject() ?
Lots of things to change before it works:
Hope @n1k0 can help me on this.