Skip to content
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

Merged
merged 18 commits into from
Dec 9, 2017
Merged

Flatten app datastructures #1

merged 18 commits into from
Dec 9, 2017

Conversation

coccyx
Copy link
Contributor

@coccyx coccyx commented Dec 6, 2017

No description provided.

@coccyx coccyx requested a review from ledbit December 6, 2017 21:32
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()))
Copy link
Contributor

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

@@ -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);
Copy link
Contributor

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?

Copy link
Contributor Author

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.

*/
datasets(sid) {
const id = { space_id: sid };
return Dataset.storeListByClass(Dataset, this, id);
Copy link
Contributor

@ledbit ledbit Dec 7, 2017

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

  1. Base.storeListByClass(Dataset, this,id) or
  2. Dataset.storeListByClass(this, id) and then in the implementation in Base use this 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];
Copy link
Contributor

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?

Copy link
Contributor Author

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];
Copy link
Contributor

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)

Copy link
Contributor Author

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.

@coccyx coccyx changed the title DO NOT MERGE - Flatten app datastructures Flatten app datastructures Dec 9, 2017
@coccyx coccyx merged commit 93f2d07 into master Dec 9, 2017
@coccyx coccyx deleted the branches/DG-341-flatten branch December 9, 2017 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants