Multiple bugs in MacroConfig + Select

I’ve noticed multiple bugs in the current implementation of the UI kit’s Select element when used with MacroConfig.

Firstly, if you set “isMulti” and select options, when reopening the config, these options are no longer selected by default. This is surely a bug, making the multi mode barely usable.

Secondly, using config resolvers yields extremely weird results for the resulting select field. I have a country selection, which formats multiple results like so:

  extensionContext: {
    contentId: '229513',
    spaceKey: 'GTP',
    config: {
      geo: '[DE, AQ]',
      startTime: '2004-01-16',
      endTime: '2020-09-16',
      keyword: 'abcd;efg'

Notice the formatting of geo is messed up. It is not produced by JSON.stringify (and therefore cannot be JSON.parsed). I currently use this function to parse results from select fields:

config.geo = config.geo
       .substr(1, config.geo.length-2)
       .map((entry) => entry.trim())

This seems odd and unintended. Please also dig into why the serialization of select fields is so weird.

All the best

1 Like

Hi there,

Could you provide a minimal reproducible app code and version of @forge/ui? I’ve tried creating a UI Kit app with a Select with “isMulti” being true and cannot reproduce the issue where selecting options and then re-opening the config clears the values. I can also seem to access the config array values without processing them:

export const Config = () => {
  return (
      <Select name="intl" label="INTL" isMulti={true} >
        <Option value="AQ" label="AQ" />
        <Option value="DE" label="DE" />
const App = () => {
  const config = useConfig();
  return (
      <Text>Hello world!</Text>

It seems that I run into the serialization issue after publishing (and not when adding and configuring just in edit mode) — could you confirm this? Will look into this further

You can track the progress of the fix here:

Thanks for raising this issue!

This is correct. When editing and leaving the config, then reopening, the correct selection is made. If the page is reloaded (with publishing or not), the selection is lost. Your minimal sample reproduces this behavior. Other fields of the UI kit do not loose state on a reload.

We’re working on rolling out a fix and will continue to update the public ticket with the progress — it may take a while as it requires an editor upgrade.
Thanks again for providing valuable bug reproduction steps!

1 Like

It’s been a while — the root cause was an issue with the Confluence backend which should now be resolved! Thanks again for raising this issue

1 Like