Add strategy and folder pinning#75
Conversation
Greptile SummaryAdds pin/unpin support for strategy tiles and folder pills, backed by a standalone Hive
Confidence Score: 4/5The change is well-scoped and the core persistence and deletion cleanup paths are correct. The two open items are cosmetic and a minor Riverpod style point — no data-correctness risk. The provider, Hive wiring, and deletion cleanup are all implemented correctly. The only rough edge is using lib/widgets/folder_content.dart — minor Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant StrategyTile/FolderPill
participant PinnedItemsProvider
participant HiveBox
participant FolderContent
User->>StrategyTile/FolderPill: Right-click / ⋮ → Pin
StrategyTile/FolderPill->>PinnedItemsProvider: togglePin(id)
PinnedItemsProvider->>HiveBox: put(id, nowMs)
PinnedItemsProvider->>PinnedItemsProvider: "state = {...state, id: nowMs}"
PinnedItemsProvider-->>FolderContent: rebuild (ref.watch)
FolderContent->>PinnedItemsProvider: pinnedIdsByRecency()
FolderContent->>FolderContent: hoist pinned items to front of lists
User->>StrategyTile/FolderPill: Delete
StrategyTile/FolderPill->>PinnedItemsProvider: removePin(id)
PinnedItemsProvider->>HiveBox: delete(id)
PinnedItemsProvider->>PinnedItemsProvider: "state = {...state}..remove(id)"
Reviews (1): Last reviewed commit: "Float pinned items to top of grid instea..." | Re-trigger Greptile |
| final pinnedIds = ref | ||
| .read(pinnedItemsProvider.notifier) | ||
| .pinnedIdsByRecency(); |
There was a problem hiding this comment.
ref.read inside build() for state access
pinnedIdsByRecency() is called via ref.read(pinnedItemsProvider.notifier) on line 183 inside build(). Riverpod's ref.read takes a snapshot at call time and does not subscribe, so in the narrow window between the ref.watch on line 180 and this ref.read, the notifier state could theoretically change (e.g. a concurrent async pin toggle completing). In practice this means pinned (line 180) and the snapshot used by pinnedIdsByRecency() could differ. Since pinned is already the full Map<String, int> state, you can derive the sorted order directly from it — no ref.read needed.
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Summary
Original pinning PR. I attempted to push the manual pinned-order follow-up directly here, but the fork branch
njiedev/icarus:feature/strategy-pinningrejected maintainer writes with 403 from my environment.Manual pinned ordering is available in follow-up PR #77 from
SunkenInTime/icarus:devin/manual-pinned-order: new pins enter at the top, pinned items ignore the app’s normal ordering while pinned, and users can reorder pins viaMove Pin to Top,Move Pin Up, andMove Pin Down.Link to Devin session: https://app.devin.ai/sessions/026effa9989f4a9c9d8ef2da902bc575
Requested by: @SunkenInTime