Lost setting of the custom field when editing a page
According to the code in the mentioned question, you need to define #default_value property and assign the $value variable to it like this:  

public function formElement(FieldItemListInterface $items, $delta, array $element, array &amp;$form, FormStateInterface $form_state) {

    $value = isset($items[$delta]-&gt;value) ? $items[$delta]-&gt;value : '';
    $client   = \Drupal::httpClient();
    $request = $client-&gt;get('http://localhost:8083/regionilist');
    $response = json_decode($request-&gt;getBody());

    $element += [
      '#type' =&gt; 'select',
      '#title' =&gt; $this-&gt;t('Select element'),
      '#options' =&gt; $response,
      '#suffix' =&gt; '&lt;div class="custom-field-widget"&gt;&lt;/div&gt;',
      '#attributes' =&gt; ['class' =&gt; ['edit-custom-field-widget']],
      '#attached' =&gt; [
        'library' =&gt; [
          'custom_field/my_js_custom_field',
        ],
      ],
      '#default_value` =&gt; $value,
    ];

    return ['value' =&gt; $element];
  }