Select initial value not working with query parameter in production (works in preview)

I have a select component that should initialize its value based on a URL query parameter. It works correctly in preview mode but fails in production — always showing the default value instead of the query parameter value.

Setup:

  1. Query variable country (Type: Query, Default: “US”, Save in local storage: Yes)

  2. Static variable with countries array:

[
  { "name": "Afghanistan", "alpha-2": "AF", "phoneCode": "93", ... },
  { "name": "France", "alpha-2": "FR", "phoneCode": "33", ... },
  ...
]
  1. Select options formula:
return variables['a9bd69fa-0035-4a70-82ce-b8a54cdeaac5'].map(country => ({
  label: country.name,
  value: country['alpha-2'],
  icon: country['alpha-2'].toLowerCase(),
  phoneCountryCode: wwFormulas.concatenate("+", country['phoneCode']) 
}));
  1. Value per item: context.mapping?.['phoneCountryCode'] (returns “+33” for France)
  2. Initial value (single) formula:
const countries = variables['a9bd69fa-0035-4a70-82ce-b8a54cdeaac5'];
const countryCode = variables['country'];
const found = countries.find(c => c['alpha-2'] === countryCode);
return found ? wwFormulas.concatenate("+", found['phoneCode']) : "+1"
```

**Behavior:**

- **Preview:** Navigate to `?country=FR` → Select correctly shows France (+33) ✅
- **Production:** Navigate to `?country=FR` → Select shows US (+1) ❌

**Debug console shows:**
```
Setting value for country
"FR"
Updating localStorage to synchronize with country

So the query parameter IS being read correctly, but the select doesn’t reflect it.

What I’ve tried:

  • “Preserve on navigation” → No effect

  • “On mounted” workflow to set the value → No effect

  • Adding delays (100ms, 1 second) before setting value → No effect

  • Checking local storage (variable not stored there despite setting)

  • Tested with single query param only → Same issue

Is there a known timing issue with query variables and select initial values in production? How can I ensure the select initializes with the correct value from the query parameter without adding loading states or delays?

Hi @DiogoDias :waving_hand:

Not sure why it would be working inside the editor but not in production.

I tried a different approach on my side which seems to work: https://www.tella.tv/video/select-with-query-72oc

Can you take a look and let me know if that works for you?