Skip to content

refactor: Refactor sync modifiers to use shared Data1D processing logic #186

@andeplane

Description

@andeplane

Problem

After extracting the common Data1D processing logic (see issue #185), the three sync modifiers need to be refactored to use the shared function, keeping only their unique logic.

Current Behavior

Each sync modifier (synccomputesmodifier.ts, syncfixesmodifier.ts, syncvariablesmodifier.ts) contains ~125 lines, with most of it being duplicated Data1D processing logic.

Expected Behavior

Refactor all three modifiers to:

  • Call the shared processData1D() helper function
  • Keep only the unique logic:
    • Which sync method to call (syncComputes(), syncFixes(), syncVariables())
    • Which name array to get (getComputeNames(), getFixNames(), getVariableNames())
    • Which collection to update in output (output.computes, output.fixes, output.variables)
  • Reduce each file from ~125 lines to ~50-60 lines

Files to Modify

  • src/modifiers/synccomputesmodifier.ts
  • src/modifiers/syncfixesmodifier.ts
  • src/modifiers/syncvariablesmodifier.ts

Prerequisites

Benefits

  • Significant reduction in code duplication
  • Easier to maintain and test
  • Consistent behavior across all sync modifiers
  • Makes it easier to add new modifiers in the future

Implementation Notes

Each modifier should:

  1. Call the appropriate sync method (syncComputes, syncFixes, or syncVariables)
  2. Get the appropriate name array
  3. Loop through names to create/update modifier objects
  4. Call the shared processData1D() function for Data1D processing
  5. Assign to the appropriate output collection
  6. Clean up the name array (see issue fix: Memory leak in sync modifiers - missing cleanup of name arrays #183)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions