Skip to content

refactor: move import merge strategy from UI to template-store#203

Open
JuliaKalder wants to merge 1 commit into
mainfrom
fix/issue-94
Open

refactor: move import merge strategy from UI to template-store#203
JuliaKalder wants to merge 1 commit into
mainfrom
fix/issue-94

Conversation

@JuliaKalder
Copy link
Copy Markdown
Owner

Summary

  • Extract importTemplates(validTemplates, mode) into modules/template-store.js — it iterates templates, compares by name (case-insensitive), applies the append/skip/replace merge mode, and returns { added, skipped, replaced }
  • executeImport in options/options.js is now a thin UI wrapper: reads the radio value, strips tracking fields, sanitizes bodies (DOM-dependent step that stays in the UI layer), then calls await importTemplates(sanitized, mode) and passes counts to showImportFeedback
  • Domain logic is no longer embedded in the UI layer

Fixes #94

- Add exportable importTemplates(validTemplates, mode) to template-store.js
  with append/skip/replace logic, returning { added, skipped, replaced }
- Slim executeImport in options.js to read the UI radio value, pre-process
  templates (strip tracking fields, sanitize body), then delegate to importTemplates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MEDIUM] executeImport merge strategy (append/skip/replace logic) embedded in options.js UI layer instead of template-store.js

1 participant