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

Bypass cache/dirty when canceling transaction #7503

Merged

Conversation

scottbell
Copy link
Contributor

@scottbell scottbell commented Feb 15, 2024

Closes #7233

Describe your changes:

When canceling a transaction, we call refresh on the object, this in turn calls get, which by default can use a cached/dirty version of the object. This isn't very helpful as the cached object is the dirty object we're trying revert! To fix this, we instead use forceRemote on the get to get the untouched version of the object.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Is this change backwards compatible? For example, developers won't need to change how they are calling the API or how they've extended core plugins such as Tables or Plots.

Author Checklist

  • Changes address original issue?
  • Tests included and/or updated with changes?
  • Has this been smoke tested?
  • Have you associated this PR with a type: label? Note: this is not necessarily the same as the original issue.
  • Have you associated a milestone with this PR? Note: leave blank if unsure.
  • Is this a breaking change to be called out in the release notes?
  • Testing instructions included in associated issue OR is this a dependency/testcase change?

Reviewer Checklist

  • Changes appear to address issue?
  • Reviewer has tested changes by following the provided instructions?
  • Changes appear not to be breaking changes?
  • Appropriate automated tests included?
  • Code style and in-line documentation are appropriate?

@scottbell scottbell linked an issue Feb 15, 2024 that may be closed by this pull request
7 tasks
@scottbell scottbell added this to the Target:4.0.0 milestone Feb 15, 2024
@@ -32,7 +32,7 @@
class="c-swatch"
:style="{ background: options.value }"
role="img"
:aria-label="None"
aria-label="None"
Copy link
Contributor Author

@scottbell scottbell Feb 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Driveby as it was throwing a warning every time the toolbar was brought up.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

Copy link

codecov bot commented Feb 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e086332) 55.39% compared to head (81f8a05) 55.39%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7503   +/-   ##
=======================================
  Coverage   55.39%   55.39%           
=======================================
  Files         671      671           
  Lines       27010    27010           
  Branches     2631     2631           
=======================================
  Hits        14961    14961           
- Misses      11326    11328    +2     
+ Partials      723      721    -2     
Flag Coverage Δ *Carryforward flag
e2e-full 41.13% <ø> (-0.01%) ⬇️ Carriedforward from fbd036d
e2e-stable 59.38% <100.00%> (+0.05%) ⬆️
unit 48.42% <100.00%> (-0.02%) ⬇️

*This pull request uses carry forward flags. Click here to find out more.

Files Coverage Δ
src/api/objects/ObjectAPI.js 92.03% <100.00%> (ø)
src/api/objects/Transaction.js 100.00% <100.00%> (ø)
src/ui/toolbar/components/ToolbarColorPicker.vue 33.33% <ø> (ø)

... and 10 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e086332...81f8a05. Read the comment docs.

@scottbell scottbell added the pr:e2e:couchdb npm run test:e2e:couchdb label Feb 15, 2024
@scottbell scottbell marked this pull request as ready for review February 15, 2024 11:24
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Feb 15, 2024
Copy link
Contributor

@ozyx ozyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all LGTM. Nice work!

@@ -35,7 +35,7 @@ const defaultFrameBorderColor = '#e6b8af'; //default border color
const defaultBorderTargetColor = '#acacac';
const defaultTextColor = '#acacac'; // default text color
const inheritedColor = '#acacac'; // inherited from the body style
const pukeGreen = '#6aa84f'; //Ugliest green known to man
const pukeGreen = '#6aa84f'; //Ugliest green known to man 🤮
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤢

@@ -411,4 +411,39 @@ test.describe('Flexible Layout styling', () => {
page.getByLabel('StackedPlot1 Frame').getByLabel('Stacked Plot Style Target')
);
});

test('Styling, and then canceling reverts to previous style', async ({ page }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fantastic

@@ -75,10 +75,10 @@ export default class Transaction {

_clear() {
const promiseArray = [];
const refresh = this.objectAPI.refresh.bind(this.objectAPI);
const action = (obj) => this.objectAPI.refresh(obj, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we love our arrow functions don't we folks? nice change

* @returns {Promise} the provided object, updated to reflect the latest persisted state of the object.
*/
async refresh(domainObject) {
const refreshedObject = await this.get(domainObject.identifier);
async refresh(domainObject, forceRemote = false) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! the forceRemote option on get() came in handy @jvigliotta

@ozyx ozyx merged commit cd560bc into master Feb 15, 2024
51 checks passed
@ozyx ozyx deleted the 7233-transactions-general-issue-with-transactions-in-openmct branch February 15, 2024 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Transactions] General issue with transactions in OpenMCT
3 participants