Open
Conversation
FilesPage never connected to `selectPins`, so it read `files?.pins` (i.e. `pageContent.pins`, always undefined) when computing `pinned` for batch-selected items. Every batch item ended up with `pinned: false`, so RemoveModal's `files.some(f => f.pinned)` was false and the "Also remove local pin" checkbox stayed hidden. Single-file context-menu delete worked because it gets `pinned` from <File> rows in FilesList, which does connect `selectPins`. Wire `selectPins` into FilesPage and use it in `selectedFiles` and `commonProps.pins`. `state.files.pins` is already `string[]` (the reducer does `.map(String)`), so no per-element `toString()` is needed. The delete action already short-circuits unpin for non-pinned items and wraps `ipfs.pin.rm` in best-effort try/catch, so mixed pinned/unpinned selections are handled idempotently. Fixes ipfs/ipfs-desktop#3134
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
It was impossible to also unpin while removing more than one file.
Why
FilesPage never connected to
selectPins, so it readfiles?.pins(i.e.pageContent.pins, always undefined) when computingpinnedfor batch-selected items. Every batch item ended up withpinned: false, so RemoveModal'sfiles.some(f => f.pinned)was false and the "Also remove local pin" checkbox stayed hidden. Single-file context-menu delete worked because it getspinnedfrom rows in FilesList, which does connectselectPins.Fix (this PR)
Wire
selectPinsinto FilesPage and use it inselectedFilesandcommonProps.pins.state.files.pinsis alreadystring[](the reducer does.map(String)), so no per-elementtoString()is needed. The delete action already short-circuits unpin for non-pinned items and wrapsipfs.pin.rmin best-effort try/catch, so mixed pinned/unpinned selections are handled idempotently.Preview