fix: Correct API field name mismatch in targeting selector widget #681
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes the targeting selector dropdown not showing the 255 custom targeting keys from GAM.
Problem
The targeting selector widget wasn't loading custom targeting keys. The dropdown stayed empty showing only "-- Select a key --" placeholder, even though 255 keys were synced from GAM.
Root Cause
Field name mismatch between API response and widget JavaScript:
customKeys(line 136 of inventory.py)custom_targeting_keys(line 129 of widget)The API endpoint
/api/tenant/{id}/targeting/allreturns the keys in a field calledcustomKeys, but the widget was looking forcustom_targeting_keys.Fix
Changed widget JavaScript to use
data.customKeysinstead ofdata.custom_targeting_keysto match the actual API response format.Result
✅ Widget will now correctly populate dropdown with all 255 custom targeting keys
✅ Users can select keys and load values
✅ Custom targeting configuration now works as intended
Testing
Once deployed, refresh the edit product page and the dropdown should show all available targeting keys from GAM.
🤖 Generated with Claude Code