-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Mutables for the Tree 🎄 + clean up TreeItem observers and mutables properly #6032
Conversation
- Ensure that the "Saving" modal dialog is closed - Notify user of the error, and also print to console to catch in e2e
- If create fails due to a conflict or otherwise, and the user immediately tries to "Create" again, default the selector tree's selected item to the "mine" folder (which we know exists).
- Only use mutables and observers if NOT a SelectorTree - Properly clean up observers and mutables when a parent item is removed from the tree
Codecov Report
@@ Coverage Diff @@
## master #6032 +/- ##
==========================================
- Coverage 55.07% 54.99% -0.09%
==========================================
Files 600 600
Lines 23696 23748 +52
Branches 2109 2112 +3
==========================================
+ Hits 13051 13060 +9
- Misses 10055 10098 +43
Partials 590 590
*This pull request uses carry forward flags. Click here to find out more.
Continue to review full report at Codecov.
|
- Error notification on 'My Items' folder missing was removed, so don't check for it
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.
This is the most I could do from my phone
const page2 = await page.context().newPage(); | ||
|
||
await Promise.all([ | ||
page.goto('./', { waitUntil: 'networkidle' }), |
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.
Woah
createDomainObjectWithDefaults(page2, { | ||
type: 'Clock' | ||
}) | ||
]); |
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 love this pattern
]); | ||
|
||
// Start logging console errors from this point on | ||
let errors = []; |
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.
Are we waiting until now because of the mine error we couldn't solve last sprint
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.
Waiting until now so that we don't capture the expected 409 error from couchdb
Testing creation of objects after a conflict appears to work: Screen.Recording.2022-12-05.at.7.26.04.PM.mov |
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.
LGTM
if (checkItem.navigationPath !== path | ||
&& checkItem.navigationPath.includes(path)) { | ||
this.destroyObserverByPath(checkItem.navigationPath); | ||
this.destroyMutableByPath(checkItem.navigationPath); |
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.
Nice!
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.
This looks really awesome. Just a couple of questions. Thanks!
- Remove check for typeof 'function' to not hide any potential coding errors
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 found a small issue in testing - #5982 (comment)
OK, I think I've got a fix for this. We rethrow the error on a conflicted save, allowing |
@@ -234,7 +234,8 @@ class CouchObjectProvider { | |||
#handleResponseCode(status, json, fetchOptions) { | |||
this.indicator.setIndicatorToState(this.#statusCodeToIndicatorState(status)); | |||
if (status === CouchObjectProvider.HTTP_CONFLICT) { | |||
throw new this.openmct.objects.errors.Conflict(`Conflict persisting ${fetchOptions.body.name}`); | |||
const objectName = JSON.parse(fetchOptions.body)?.model?.name; |
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. Thank you for doing doing this. I was running into this one as well.
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.
Looks great! Awesome work!
…vers and mutables properly * fix: refresh object after conflict error * fix: recover from error thrown during create - Ensure that the "Saving" modal dialog is closed - Notify user of the error, and also print to console to catch in e2e * fix: default selector tree item to 'mine' folder - If create fails due to a conflict or otherwise, and the user immediately tries to "Create" again, default the selector tree's selected item to the "mine" folder (which we know exists). * fix: don't listen to composition if Selector Tree * refactor: remove dead code * fix: use MutableDomainObjects in the tree - Only use mutables and observers if NOT a SelectorTree - Properly clean up observers and mutables when a parent item is removed from the tree * test: verify conflicts don't break object creation * test: verify dialog closes and object is created * refactor(e2e): update test - Error notification on 'My Items' folder missing was removed, so don't check for it * test: increase timeout * refactor(e2e): use Promise.any() * refactor(e2e): use Promise instead of polling * test: add 2p annotation * test: use `waitForRequest` instead of promise - tidy up test, add comments describing our pattern * docs(e2e): add best practices for network tests * refactor(e2e): avoid using Promise.any * fix: de-reactify observer and mutable maps * fix: destroy by path on treeItem close * fix: don't refresh for synchronized objects * docs: fix a typo 🔥 * fix: remove existing mutable before adding * fix: fail fast if these aren't functions - Remove check for typeof 'function' to not hide any potential coding errors * fix: walk up navigationPath if item not found * chore: fix lint errors * fix: parse conflicted object name correctly * fix: re-throw conflict error * fix: Cancel edit mode on conflict
Closes #5982 #5975
Describe your changes:
All Submissions:
Author Checklist
Reviewer Checklist