Bulk Reopen
Relevant source files
The following files were used as context for generating this wiki page:
- src/entries/background/handlers/bulk-handlers.ts
- src/components/bulk/bulk-actions-bar.tsx
- src/entries/background/helpers.ts
- README.md
- src/lib/graphql/mutations.ts (Referenced via imports in handlers)
The Bulk Reopen feature is a core status management utility within the Refined GitHub Projects extension. It allows users to restore multiple closed GitHub issues or pull requests to an active state simultaneously directly from the GitHub Projects V2 table view. This operation bypasses the need to manually open each item, significantly improving workflow efficiency for project managers and developers.
This feature is integrated into the Bulk Actions Bar and utilizes a sequential background queue to ensure compliance with GitHub's API rate limits and safety requirements.
Sources: README.md:91, README.md:126, src/entries/background/handlers/bulk-handlers.ts:316-320
Architecture and Data Flow
The Bulk Reopen process follows a distributed architecture involving the Content Script (UI), a Background Service Worker, and the GitHub GraphQL API.
User Interaction and Messaging
The process is initiated when a user selects multiple items in the project table and selects "Reopen Issues" from the actions menu or uses the ⌘⇧O / ⌃⇧O keyboard shortcut. The frontend component BulkActionsBar then sends a bulkOpen message containing the selected item IDs and the project ID to the background script.
Sources: src/components/bulk/bulk-actions-bar.tsx:493-497, src/components/bulk/bulk-actions-bar.tsx:640-645
Background Processing logic
The background handler for bulkOpen manages the lifecycle of the operation through several distinct phases:
- Concurrency Check: Validates if the maximum number of concurrent bulk updates has been reached.
- ID Resolution: Converts DOM-extracted IDs (e.g.,
issue:123) into valid GitHub GraphQL Node IDs. - Task Queueing: Creates a
QueueTaskfor each item and processes them sequentially with a 1-second delay between mutations. - State Broadcasting: Sends real-time progress updates back to the UI to drive the live tracker.
Sources: src/entries/background/handlers/bulk-handlers.ts:316-339, src/entries/background/handlers/bulk-handlers.ts:341-382
Sequential Execution Flow
The following diagram illustrates the sequence of operations from the user's click to the final API mutation.
Implementation Details
Key Components
The logic is split between the UI confirmation modal and the background execution handler.
| Component | Responsibility |
|---|---|
BulkActionsBar | Detects selection and triggers the workflow. |
BulkOpenModal | Provides user confirmation before starting the destructive API calls. |
bulkOpen Handler | Orchestrates ID resolution and the processQueue execution. |
REOPEN_ISSUE | The GraphQL mutation used to update the issue state. |
Sources: src/components/bulk/bulk-actions-bar.tsx:640, src/entries/background/handlers/bulk-handlers.ts:316, src/entries/background/handlers/bulk-handlers.ts:352
Background Handler Logic
The bulkOpen message listener ensures that operations are rate-limit safe by wrapping mutations in the processQueue utility.
// src/entries/background/handlers/bulk-handlers.ts:351-356
const tasks: QueueTask[] = resolvedItems.map(({ domId, issueNodeId }) => ({
id: `open-${domId}`,
run: async () => {
await gql(REOPEN_ISSUE, { issueId: issueNodeId })
await sleep(1000)
},
}))
Sources: src/entries/background/handlers/bulk-handlers.ts:351-356
Rate Limit and Safety
- 1s Delay: Every reopen mutation is followed by
await sleep(1000)to prevent the GitHub Personal Access Token (PAT) from being flagged for abuse. - Sequential Execution: Tasks are processed one by one;
Promise.all()is explicitly avoided. - Concurrency Lock: The
acquireBulk()andreleaseBulk()functions prevent multiple large-scale status updates from overlapping.
Sources: src/entries/background/handlers/bulk-handlers.ts:321-325, src/entries/background/handlers/bulk-handlers.ts:355, README.md:310-313
User Interface
The Bulk Reopen feature is accessible via the floating actions bar that appears at the bottom of the screen when items are selected.
- Keyboard Shortcut:
⌘⇧O(Mac) or⌃⇧O(Windows/Linux). - Menu Path: Actions -> Status -> Reopen Issues.
- Visual Feedback: A live queue tracker shows the progress (e.g., "Reopening item 2 of 5...") and confirms completion with a "Done!" state.
Sources: src/components/bulk/bulk-actions-bar.tsx:112, src/components/bulk/bulk-actions-bar.tsx:840-867, src/entries/background/handlers/bulk-handlers.ts:365-375
The functionality is strictly limited to issues and pull requests resolved within the specified project context. If no valid items are resolved during the resolution phase, the process aborts to prevent unnecessary API overhead.
Sources: src/entries/background/handlers/bulk-handlers.ts:346-349