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

createInterpolateElement is breaking backwards compatibility within Advanced filters #39021

Closed
2 of 4 tasks
louwie17 opened this issue Jun 29, 2023 · 0 comments · Fixed by #39049
Closed
2 of 4 tasks
Assignees
Labels
focus: analytics plugin: woocommerce Issues related to the WooCommerce Core plugin. type: bug The issue is a confirmed bug.

Comments

@louwie17
Copy link
Contributor

Prerequisites (mark completed items with an [x]):

Issue Description:

We are currently handling interpolation of the title attribute within the AdvancedFilters. This is also something that can be extended by plugins.
We recently replaced our interpolation function for this in this PR: #37967
which also requires a different syntax ( {{ select /}} to <select /> ). This is currently breaking backwards compatibility in other plugins. See fix in WC Pay for example: https://github.com/Automattic/woocommerce-payments/pull/6617/files

We should re-introduce interpolateComponents when the old format is used and add a deprecation warning. Otherwise we can use the new format.
It might be relatively save to replace the format on the fly with some code like this:

const tokenizerold = /(\{\{\/?\s*\w+\s*\/?\}\})/g; // taken from https://github.com/Automattic/wp-calypso/blob/trunk/packages/interpolate-components/src/tokenize.js#L30
if ( tokenizerold.exec( title ) !== null ) {
  deprecated( .... );
  newTitle = title.replaceAll(/(\{\{(\/?\s*\w+\s*\/?)\}\})/g, "<$2>") 
}

Acceptance criteria

  • Advanced filters should still work with old interpolation format such as "{{title}}Status{{/title}} {{rule /}} {{filter /}}"
  • If old format is used a deprecation message should show
@louwie17 louwie17 added type: bug The issue is a confirmed bug. plugin: woocommerce Issues related to the WooCommerce Core plugin. focus: analytics labels Jun 29, 2023
@octaedro octaedro self-assigned this Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: analytics plugin: woocommerce Issues related to the WooCommerce Core plugin. type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants