Skip to content

refactor: separate concerns in insertTemplateIntoTab#199

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

refactor: separate concerns in insertTemplateIntoTab#199
JuliaKalder wants to merge 1 commit into
mainfrom
fix/issue-61

Conversation

@JuliaKalder
Copy link
Copy Markdown
Owner

Summary

  • Replace dynamic import() with static top-level import of template-store.js (already present at the module top; this refactor confirms and locks that separation)
  • Extract decodeAndAttach(tabId, attachments) as a separately exported async function, isolating the base64 decode + messenger.compose.addAttachment loop from domain logic in insertTemplateIntoTab
  • No behaviour change — all callers (background.js, popup/popup.js) continue to work unchanged

Verification

  • npm test passes; the 7 pre-existing failures in migrateV0toV1 are unrelated to this change
  • decodeAndAttach is now independently importable and testable

Fixes #61

…nsert.js (#61)

- The dynamic import() of template-store.js that previously existed inside
  insertTemplateIntoTab has already been replaced by a static top-level import;
  this commit confirms and preserves that separation.
- Extract the base64-decode + messenger.compose.addAttachment loop into a new,
  separately exported async function decodeAndAttach(tabId, attachments).
  This isolates infrastructure/attachment concerns from the domain logic in
  insertTemplateIntoTab, making each function independently testable.
- No behaviour change; all callers continue to work unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

[HIGH] insertTemplateIntoTab mixes data access, infrastructure, and domain logic in one function (template-insert.js)

1 participant