-
Notifications
You must be signed in to change notification settings - Fork 0
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
Flatten app datastructures #1
Conversation
src/js/actions/spaces.js
Outdated
return Dataset.load(spaceId, datasetId) | ||
.then((d) => { dataset = d; return Spaces.dispatchLoad(File.load(dataset)); }) | ||
.then(() => Spaces.dispatchLoad(Annotation.load(dataset))) | ||
.then(() => Spaces.dispatchLoad(dataset.index())) |
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.
theoretically loading the annotations and indexing can happen in parallel
src/js/actions/spaces.js
Outdated
@@ -151,7 +152,7 @@ export function annotationCommentCreate(annotation, text) { | |||
* @param {string} text | |||
*/ | |||
export function annotationCommentUpdate(annotation, id, text) { | |||
return promiseDispatch(() => (annotation.updateComment(id, text)), ANNOTATION_COMMENT_UPDATE); | |||
return promiseDispatch(() => (annotation.updateComment(id, text)), DIAG_UPDATE); |
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.
can these few promiseDispatch
be Spaces.dispatchUpdate
?
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.
Yes, I'm moving them back to the UI.
src/js/app/spaces.js
Outdated
*/ | ||
datasets(sid) { | ||
const id = { space_id: sid }; | ||
return Dataset.storeListByClass(Dataset, this, id); |
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 recommend either doing either
Base.storeListByClass(Dataset, this,id)
orDataset.storeListByClass(this, id)
and then in the implementation inBase
usethis
to figure out what class the method was called on
(yes this
is accessible in static methods too)
if (itemIdx === -1) { | ||
ret[key] = [...selfs, this]; | ||
} else { | ||
ret[key] = [...selfs]; |
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.
don't we want to replace if already there?
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 should be expressly calling update. Load on the other hand is an upsert.
if (itemIdx > -1) { | ||
ret[this._getKey()] = [...selfs.slice(0, itemIdx), insert, ...selfs.slice(itemIdx + 1)]; | ||
} else { | ||
ret[this._getKey()] = [...selfs]; |
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.
do we really need to return a copy in case of noop? (ditto for storeDelete
)
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.
Probably not, I'll fix that up and test.
No description provided.