nf-core modules update changed md5sum of skipped module in modules.json
### Description of the bug

Hey!

I ran `nf-core modules update -a` and then selected the second option (show diff and y/N before applying it). For two modules the md5sum was changed, even though I selected N and skipped the update:

see here:

https://github.com/nf-core/sarek/pull/822/files#diff-97c7fe3fe8f628d2435d00b93af4cb47052e8e1f3d33b7334d1a031fd15415d7

### Command used and terminal output

```console
nf-core modules update -a
```


### System information

Using nf-core/tools 2.6
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2ec68794..65a967e9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -33,6 +33,8 @@
 
 ### Modules
 
+- Don't update `modules_json` object if a module is not updated ([#2323](https://github.com/nf-core/tools/pull/2323))
+
 ### Subworkflows
 
 ### General
diff --git a/nf_core/components/update.py b/nf_core/components/update.py
index 5f8a2129..6fc6e035 100644
--- a/nf_core/components/update.py
+++ b/nf_core/components/update.py
@@ -306,16 +306,6 @@ class ComponentUpdate(ComponentCommand):
                     # Update linked components
                     self.update_linked_components(modules_to_update, subworkflows_to_update, updated)
                     self.manage_changes_in_linked_components(component, modules_to_update, subworkflows_to_update)
-            else:
-                # Don't save to a file, just iteratively update the variable
-                self.modules_json.update(
-                    self.component_type,
-                    modules_repo,
-                    component,
-                    version,
-                    installed_by=None,
-                    write_file=False,
-                )
 
         if self.save_diff_fn:
             # Write the modules.json diff to the file
['nf_core/components/update.py', 'CHANGELOG.md']