Skip to content

Clean shelf state after removals#8

Open
sickn33 wants to merge 1 commit into
chenyuxiaojin:mainfrom
sickn33:clean-shelf-removal-state
Open

Clean shelf state after removals#8
sickn33 wants to merge 1 commit into
chenyuxiaojin:mainfrom
sickn33:clean-shelf-removal-state

Conversation

@sickn33

@sickn33 sickn33 commented Jun 29, 2026

Copy link
Copy Markdown

Summary

  • centralize shelf item removal cleanup
  • cancel thumbnail/info tasks and remove cache entries for every removal path
  • clear stale selection and lastSelectedId when items are removed or all items are cleared
  • add tests for selection cleanup after item and URL removals

Why

Different shelf removal paths handled different parts of cleanup. removeItem(_:) cancelled tasks, but removeItems(byUrls:), removeItem(at:), max-item pruning, and clearAll() could leave selection state or background thumbnail/info tasks associated with removed items. This keeps the view model state internally consistent after every removal path.

Verification

  • git diff --check
  • xcodebuild test -project DropKit/DropKit.xcodeproj -scheme DropKit -destination 'platform=macOS' -derivedDataPath /private/tmp/dropkit-shelf-cleanup-derived CODE_SIGNING_ALLOWED=NO passed 13 tests, 0 failures

@sickn33 sickn33 force-pushed the clean-shelf-removal-state branch from ca7bbf3 to 529a145 Compare June 29, 2026 15:47
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.

2 participants