Reload page when toggling new-product-management-experience (#38348)
* Add callback to reload page when togglint new-product-management-experience * Add changelog * Implement reload for product-block-editor and code review suggestions
This commit is contained in:
parent
ebf0b92960
commit
ef0a32ff48
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: enhancement
|
||||
|
||||
Reload page when toggling new-product-management-experience and product-block-editor
|
|
@ -23,6 +23,15 @@ function Features() {
|
|||
|
||||
const sortedFeatureNames = Object.keys( features ).sort();
|
||||
|
||||
const afterToggleCallback = {
|
||||
'new-product-management-experience': () => {
|
||||
window.location.reload();
|
||||
},
|
||||
'product-block-editor': () => {
|
||||
window.location.reload();
|
||||
},
|
||||
};
|
||||
|
||||
return (
|
||||
<div id="wc-admin-test-helper-features">
|
||||
<h2>
|
||||
|
@ -43,8 +52,9 @@ function Features() {
|
|||
<ToggleControl
|
||||
label={ feature_name }
|
||||
checked={ features[ feature_name ] }
|
||||
onChange={ () => {
|
||||
toggleFeature( feature_name );
|
||||
onChange={ async () => {
|
||||
await toggleFeature( feature_name );
|
||||
afterToggleCallback[ feature_name ]?.();
|
||||
} }
|
||||
/>
|
||||
</li>
|
||||
|
|
Loading…
Reference in New Issue