Skip to content

fix(viewer): image pan/zoom, sort fixes, sidebar dot fixes#3836

Merged
waleedlatif1 merged 4 commits intostagingfrom
fix/viewer
Mar 29, 2026
Merged

fix(viewer): image pan/zoom, sort fixes, sidebar dot fixes#3836
waleedlatif1 merged 4 commits intostagingfrom
fix/viewer

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

@waleedlatif1 waleedlatif1 commented Mar 29, 2026

Summary

  • Added canvas-style pan and zoom to the image viewer on the Files tab — drag to pan, Ctrl/Cmd + scroll to zoom, zoom buttons with live percentage in the corner
  • Fixed sort key mapping for chunk index column in document view
  • Disabled infinite scroll load-more when a sort is active in logs
  • Hide sidebar task status dots when the context menu is open

Type of Change

  • Bug fix
  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Mar 29, 2026 7:33pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Mar 29, 2026

PR Summary

Low Risk
Low risk UI/UX changes limited to client-side viewer/table behaviors; main risk is minor interaction regressions in wheel/drag handling and pagination when sorting.

Overview
Adds canvas-style interactions to the Files image preview: drag-to-pan, Ctrl/Cmd+wheel zoom with clamped limits, and zoom controls showing the current percentage.

Fixes a document chunks sorting bug by mapping the Index column to the backend chunkIndex sort key, and prevents Logs infinite-scroll pagination (onLoadMore/hasMore) from triggering while a client-side sort is active.

Hides sidebar task status dots while the task context menu is open to avoid visual overlap/confusion.

Written by Cursor Bugbot for commit e48ec43. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 29, 2026

Greptile Summary

This PR bundles four targeted fixes across the workspace UI:

  • Image viewer pan/zoom (file-viewer.tsx): Replaces the static <img> display with a fully interactive canvas-style viewer — drag to pan, Ctrl/Cmd+scroll to zoom, trackpad two-finger scroll to pan, and zoom buttons with a live percentage readout. The implementation correctly uses a passive: false wheel listener, calls e.preventDefault() unconditionally (fixing page scroll bleed-through), and stopPropagation on the zoom control's mousedown (preventing spurious drag activation from earlier review threads). State resets cleanly on file change.
  • Document sort key fix (document.tsx): Corrects a fallthrough bug where any active sort that wasn't tokens or status would incorrectly pass chunkIndex as the sort key. The fix properly gates chunkIndex on activeSort?.column === 'index'.
  • Logs infinite scroll guard (logs.tsx): Prevents loadMoreLogs from firing (and hides the hasMore indicator) while a sort is active, avoiding a likely incompatibility between sorted results and cursor-based pagination.
  • Sidebar dot visibility (sidebar.tsx): Hides the amber active-task and unread-indicator dots whenever the row's context menu is open, removing the visual overlap between the dots and the MoreHorizontal button.

Confidence Score: 5/5

Safe to merge — all changes are well-scoped bug fixes and a contained new feature with no P0/P1 issues.

All four changes are minimal and targeted. The two previously flagged issues in the image viewer (unconditional preventDefault and zoom-button drag bubbling) are confirmed resolved. The sort key fix, infinite-scroll guard, and sidebar dot visibility change are all correct and low-risk. No remaining findings rise above P2.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsx Adds canvas-style pan/zoom to ImagePreview: drag-to-pan via mouse, Ctrl/Cmd+scroll to zoom, scroll-wheel pan, and zoom buttons with live percentage. Previous issues (scroll preventDefault and zoom-button drag bubbling) are confirmed resolved.
apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx Fixes sort key mapping: the index column now correctly maps to chunkIndex instead of the previous bug where any non-tokens/non-status active sort would fall through to chunkIndex.
apps/sim/app/workspace/[workspaceId]/logs/logs.tsx Disables infinite scroll load-more when a sort is active via an early return in loadMoreLogs and setting hasMore to false when activeSort is truthy.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx Hides sidebar task status dots (active/unread) when the context menu is open by adding !isMenuOpen guards to three status-dot spans.

Reviews (3): Last reviewed commit: "fix(file-viewer): use exponential zoom f..." | Re-trigger Greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

Good catches — both fixed in 5e7e979:

  • e.preventDefault() moved outside the ctrl/meta branch so plain scroll is also captured
  • Added onMouseDown={(e) => e.stopPropagation()} on the zoom controls wrapper to stop bubbling to the drag handler

Copy link
Copy Markdown
Collaborator Author

@waleedlatif1 waleedlatif1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both issues fixed in 5e7e979e.preventDefault() now applies to all wheel events (not just ctrl/meta), and the zoom controls wrapper has onMouseDown stopPropagation to block micro-pans.

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@waleedlatif1 waleedlatif1 merged commit 336c065 into staging Mar 29, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/viewer branch March 29, 2026 19:40
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.

1 participant