Skip to content

fix(files): unpin option missing in batch delete#2488

Open
lidel wants to merge 1 commit intomainfrom
fix/batch-delete-unpin-checkbox
Open

fix(files): unpin option missing in batch delete#2488
lidel wants to merge 1 commit intomainfrom
fix/batch-delete-unpin-checkbox

Conversation

@lidel
Copy link
Copy Markdown
Member

@lidel lidel commented Apr 21, 2026

Problem

It was impossible to also unpin while removing more than one file.

Why

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 rows in FilesList, which does connect selectPins.

Fix (this PR)

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.

Preview

image

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

How to cancel pinning while deleting in batch?

1 participant