Skip to content

Conversation

@nathanss
Copy link
Contributor

Submission Review Guidelines:

Changes proposed in this Pull Request:

This addresses an issue where certain store alerts can be undismissable based on a race condition.

The issue itself is very hard to reproduce. I was unable to, but we're pretty sure that this was what's causing the issue.

Optional: Check #37710 for all the context that led to this solution.

Closes #36913 .

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. With WCA Test Helper installed, go to Tools > WCA Test Helper.
  2. Go to Admin Notes tab.
  3. Add one or more alerts of type: update.
  4. Go to WooCommerce > Home.
  5. Click the 'Test Action' button.
  6. Check if the message disappears.
  7. Optional: manually set the button's link's href to '#' through dev tools inspector.
  8. Click it
  9. Check that the alert is dismissed without reloading the page

@github-actions github-actions bot added focus: react admin [team:Ghidorah] plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Apr 28, 2023
@nathanss nathanss requested a review from a team April 28, 2023 14:53
@github-actions
Copy link
Contributor

Hi , @woocommerce/mothra-enhancements

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@github-actions
Copy link
Contributor

github-actions bot commented Apr 28, 2023

Test Results Summary

Commit SHA: 22c4bdd

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests26700202690m 54s
E2E Tests1870010019715m 25s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

Copy link
Contributor

@mattsherman mattsherman left a comment

Choose a reason for hiding this comment

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

This is looking pretty good! I requested a change to hook into our wc-admin routing, to avoid unnecessary full page reloads.

Comment on lines 81 to 83
if ( url && url !== '#' ) {
window.location.href = url;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

When testing this, I noticed that the entire page gets reloaded if the url is the same as the current page, or if the url is to another wc-admin page.

The following prevents this:

if (
	url &&
	url !== '#' &&
	parseAdminUrl( url ).href !== window.location.href
) {
	navigateTo( { url } );
}

Using the following imports:

import { navigateTo, parseAdminUrl } from '@woocommerce/navigation';

@louwie17
Copy link
Contributor

louwie17 commented May 2, 2023

@nathanss would this address this issue as well? #32187

@nathanss
Copy link
Contributor Author

nathanss commented May 2, 2023

@louwie17 I believe it will

@codecov
Copy link

codecov bot commented May 2, 2023

Codecov Report

Merging #38047 (22c4bdd) into trunk (d8b28ee) will decrease coverage by 0.2%.
The diff coverage is 25.0%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             trunk   #38047     +/-   ##
==========================================
- Coverage     51.5%    51.3%   -0.2%     
- Complexity   17281    17409    +128     
==========================================
  Files          430      440     +10     
  Lines        80033    80584    +551     
==========================================
+ Hits         41217    41309     +92     
- Misses       38816    39275    +459     
Impacted Files Coverage Δ
...ocommerce/includes/admin/class-wc-admin-assets.php 0.0% <0.0%> (ø)
...ommerce/includes/abstracts/abstract-wc-product.php 88.3% <100.0%> (ø)

... and 28 files with indirect coverage changes

Copy link
Contributor

@mattsherman mattsherman left a comment

Choose a reason for hiding this comment

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

Thanks for the updates, @nathanss !

LGTM! :shipit:

@nathanss nathanss merged commit 4145b6e into trunk May 2, 2023
@nathanss nathanss deleted the fix/undismissable-notice2 branch May 2, 2023 14:17
@github-actions github-actions bot added this to the 7.8.0 milestone May 2, 2023
@therealakfaulkner
Copy link

Still happening in 7.9.0

@urbaman
Copy link

urbaman commented Aug 7, 2023

Hi, happening with Woocommerce 7.9.0 here as well.

@anastas10s-afk
Copy link
Contributor

6628287-zen

@nathanss
Copy link
Contributor Author

Hello. There was an additional fix for this: #38967

Please update to 8.0.0 or above and see if it fixes the issue.

@tonyastley
Copy link

tonyastley commented Aug 23, 2023

Fixed for me in 8.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Undismissable notice

8 participants