Save custom field value from edit topic area?

AI-generated summary

JQ331 is having trouble saving custom field values from the edit topic area. They’ve successfully implemented the custom field feature using code from this guide and this GitHub repo, but the value entered in the edit-topic connector input field disappears after saving the edit. They’ve added the necessary code to the edit-topic-custom-field-container.hbs file and topic-custom-field-initializer.js.es6 file, but are still unable to save the custom field value.

Hi There. Using the code that @angus has laid out here, and following the github repo, I’m able to get the topic custom field working well–except for enabling it to be edited in the “header” area of the composer (where you normally are able to edit the category, for instance; ie, in the edit-topic connector).

I’ve followed the code for this in the repo, including the code at plugin.rb and elsewhere. For instance, I’ve added the input in the file connectors/edit-topic/edit-topic-custom-field-container.hbs (like here):

{{#if isString}}
  {{input
    type="text"
    value=(readonly fieldValue)
    class="topic-custom-field-input large"
    input=(action "onChangeField" value="target.value")
    placeholder=(i18n 'topic_custom_field.placeholder' field=fieldName)
  }}
{{/if}}

And then also the code in the topic-custom-field-initializer, like this:

api.registerConnectorClass('edit-topic', 'edit-topic-custom-field-container', {
        setupComponent(attrs, component) {
          const model = attrs.model;
          
          let props = {
            fieldName: fieldName,
            fieldValue: model.get(fieldName)
          }
          component.setProperties(Object.assign(props, fieldInputTypes(fieldType)));
        },
        
        actions: {
          onChangeField(fieldValue) {
            this.set(`buffered.${fieldName}`, fieldValue);
          }
        }
      });

... 
  api.serializeOnCreate(fieldName);
      api.serializeToDraft(fieldName);
      api.serializeToTopic(fieldName, `topic.${fieldName}`);

But: while the other repo code works for me (like adding the custom field value in the composer value), and I get no errors, I am not able to save the value I enter in the edit-topic connector input. If I enter a value there, the value disappears after the edit is saved.

Is it possible that something else is required for saving the value in the edit-topic connector?