Skip to content

[Refactor] Extract checksumsByKey helper in theme-polling - #8970

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
refactor-maintenance-39520936982
Draft

github-actions[bot] wants to merge 1 commit into
mainfrom
refactor-maintenance-39520936982

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

getAssetsDeletedFromRemote and getAssetsChangedOnRemote in theme-polling.ts each hand-rolled the same "index checksums by key" Map construction, and each assigned its filter result to a named local only to return it on the next line. One of the two filter callbacks also relied on an implicit undefined fall-through to mean "exclude this asset", which is easy to misread as a missing return.

WHAT is this pull request doing?

Extracts the shared checksumsByKey helper used by both remote-checksum diffing functions, returns the filter results directly instead of via single-use locals, and makes the exclusion case in getAssetsChangedOnRemote an explicit false.

Behavior is unchanged. The deleted-asset check moves from map.get(key) === undefined to map.has(key), which is equivalent here because the map values are always Checksum objects and never undefined.

How to manually test your changes?

shopify theme dev --theme-editor-sync

Edit a file in the theme editor and confirm the change syncs down locally, then delete a file in the theme editor and confirm it is removed locally.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

0 participants