Update hooks are overwriting existing config
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3587948. -->
Reported by: [progga](https://www.drupal.org/user/163062)
Related to !41
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>The newly added <code>localgov_elections_update_10008()</code> and <code>localgov_elections_update_10010() </code> update hook implementations are overwriting existing configs while updating those configs. Affected configs include:<br>
- core.entity_form_display.node.localgov_area_vote.default<br>
- core.entity_view_display.node.localgov_area_vote.default<br>
- core.entity_view_display.node.localgov_area_vote.teaser</p>
<p>After running these updates, the UUID is gone along with mentions of some fields from other modules; example: <code>localgov_service_contacts</code>, <code>localgov_services_parent</code>, etc.</p>
<p>This issue only affects existing users of this module.</p>
<h2 id="summary-steps-reproduce">Steps to reproduce</h2>
<pre>$ composer update drupal/localgov_elections<br>$ drush updatedb<br>$ drush config:export<br>$ cd /path/to/drupal/config/store/<br>$ git diff </pre><h2 id="testing">Suggested testing steps</h2>
<ol>
<li>Install localgov_elections 3.1 </li>
<li>Enable localgov_elections demo_content </li>
<li>Enable localgov_demo_content</li>
<li>Make some customisations to area vote form or view displays</li>
<li>Get the branch code.</li>
<li>Run drush updb</li>
<li>Updates should apply the configuration without affecting other customisations</li>
</ol>
<h2 id="risks">Risks to consider</h2>
<p>Update hooks were already run from 3.2.0</p>
<p>Release notes should mention the issue and suggest manual updates to desired state.</p>
<h2 id="summary-proposed-resolution">Proposed resolution</h2>
<p><code>localgov_elections_update_10008()</code> and <code>localgov_elections_update_10010()</code> should <strong>alter</strong> existing configs rather than overwriting them with their newest copy from <code>/config/install/</code>. <code>localgov_elections_update_10009()</code> offers a good example.</p>
issue