Add __unstableHTML option to createNotice() with API error messages where appropriate #32190
Labels
plugin: woocommerce
Issues related to the WooCommerce Core plugin.
priority: normal
The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc.
type: enhancement
The issue is a request for an enhancement.
Issue woocommerce/woocommerce-admin#4314 referenced one particular API call whose error message gets put into a Snackbar via
createNotice()
. As of PR woocommerce/woocommerce-admin#8173 it's possible to preserve tags in messages displayed in a Snackbar if you pass{ __unstableHTML: true }
as a third parameter tocreateNotice()
. This only affects the specific Sample Products Import case, so any other API calls that display server-provided messages in aSnackbar
might need the same change.From @joshuatf's review:
Just noting that we still need a follow-up for this. This solves the issue in this task, but we would need to do this in all REST API calls since this error has the potential to pop up in any of those.
I would love a more catch-all solution, but this may be the best to handle this.
Originally posted by @joshuatf in woocommerce/woocommerce-admin#8173 (comment)
The text was updated successfully, but these errors were encountered: