craftcms / commerce

Fully integrated ecommerce for Craft CMS.
https://craftcms.com/commerce
Other
225 stars 170 forks source link

[5.x]: Small inconvenience when looking up product / variant fields to add to their field layout #3695

Open hatyi opened 1 month ago

hatyi commented 1 month ago

What happened?

Description

Hello I'm reporting a minor, frontend related inconvenience in the admin. I'm working on a project where we have a very complex product / variant field layout and when I'm trying to look up the fields I have created by their name / handle to add them to the required field layouts (product or variant), the system is listing out the previous matches as well, not only the ones that should appear based on the search term.

Steps to reproduce

  1. Create multiple fields
  2. GOTO /admin/commerce/settings/producttypes/[n]/1#variant-fields or /admin/commerce/settings/producttypes/[n]/1#product-fields
  3. Search for a new field
  4. Add it to a field layout group (don't save)
  5. Search for a new field
  6. Now you should see the previous match / field you searched for as well in addition to the new field you searched for

Expected behavior

The system only lists out valid matches based on the search term. We don't see the previous matches in addition to the correct one.

Actual behavior

System is seemingly listing out the previous matches as well in addition to the correct one. I'm assuming that some kind of JS array is not being emptied out when a new search is fired, so the system unnecessarily remembers the previous matches. (I didn't see any XHR when I'm doing these searches that's why I believe it's just a frontend bug)

Craft CMS version

5.4.4

Craft Commerce version

5.1.1

PHP version

PHP 8.2.22 (cli)

Operating system and version

Ubuntu 22.04 (running PHP FPM, Nginx, MySQL in Docker)

Database type and version

mysql:8.0.36

Image driver and version

No response

Installed plugins and versions

"algolia/algoliasearch-client-php": "^3.4",
"craftcms/ckeditor": "4.2.0",
"craftcms/cms": "5.4.4",
"craftcms/commerce": "5.1.1",
"mmikkel/incognito-field": "2.0.0",
"nystudio107/craft-vite": "5.0.1",
"presseddigital/linkit": "5.0.0",
"putyourlightson/craft-sendgrid": "3.0.0",
"setasign/fpdi": "^2.6",
"studioespresso/craft-scout": "5.0.1",
"tecnickcom/tcpdf": "^6.7",
"verbb/formie": "3.0.7",
"verbb/navigation": "3.0.4",
"verbb/wishlist": "3.0.3",
"vlucas/phpdotenv": "^5.4.0",
"yiisoft/yii2-redis": "^2.0"
linear[bot] commented 1 month ago

PT-2179 [5.x]: Small inconvenience when lookup up product / variant fields to add to their field layout

lukeholder commented 1 month ago

@hatyi can you confirm is this is only for products/variants and it doesn't do the same with entry types?