Skip to content

DiffHubs View Transitions#624

Closed
amadeus wants to merge 31 commits into
beta-1.2from
amadeus/diffs-hub-transitions
Closed

DiffHubs View Transitions#624
amadeus wants to merge 31 commits into
beta-1.2from
amadeus/diffs-hub-transitions

Conversation

@amadeus
Copy link
Copy Markdown
Member

@amadeus amadeus commented May 1, 2026

Experimenting with ViewTransitions

@vercel
Copy link
Copy Markdown

vercel Bot commented May 1, 2026

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

Project Deployment Actions Updated (UTC)
pierre-docs-diffshub Ready Ready Preview May 8, 2026 3:06am
pierre-docs-trees Ready Ready Preview May 8, 2026 3:06am
pierrejs-diff-demo Ready Ready Preview May 8, 2026 3:06am
pierrejs-docs Ready Ready Preview May 8, 2026 3:06am

Request Review

@amadeus amadeus force-pushed the amadeus/diffs-hub-transitions branch from 9dbfc92 to d7915d1 Compare May 1, 2026 21:49
@amadeus amadeus force-pushed the amadeus/diffs-hub-transitions branch from d7915d1 to ec8ad67 Compare May 5, 2026 00:29
@amadeus amadeus force-pushed the amadeus/diffs-hub-transitions branch from ec8ad67 to 87f3639 Compare May 5, 2026 19:35
amadeus and others added 12 commits May 7, 2026 19:50
* Revert "Virtualization beta release prep"

This reverts commit 484569f.

* Optimize ResizeManager for column updates

* Fix potential double fire bug with UniversalRenderingManager

* Stage 1 of refactor:

Reworking existing VirtualizedFile and VirtualizedFileDiff to work with
both simple and advanced virtualizers

Stuff is stubbed out right now, but not ready for prime time

* Fix bug with recycling and custom css

* calm before the storm

* prep for the hard shit

* First pass at managing dynamic heights

I tried to get AI to do this, but it really sucked, so I did it myself.

The main goal of this commit is to handle the post render
reconciliation.  So utilizing many of the APIs from the simple
virtualizer, with a few tweaks, we can effectively dynamically adjust
the offsets to ensure that we are positioned properly.

This does not include scroll anchoring yet, which is another issue and
it also doesn't manage if things resize between renders, which I think
we'll use a resize observer on the sticker container thing to manage
that, but still more work to be done.

I am noticing pretty heavy render times in some more extreme cases, so
there's probably still a lot of work to do in that regard.

* dumb things

* Detect if code can resize

* Fix virtualization with empty gutter column

* Implement scroll fixing

This might be the final functional thing required for this shit...

Now i need to test if annotations can work...

* mdo was here

* absolute slop pocalypse

* Revert "absolute slop pocalypse"

This reverts commit 6ff638235380b4c546e9aa3967ff2a3474d86795.

* Revert query param for now

* big boi

* Reworking to CodeViewer

This is step 1 of this new idea I had to productize this into a code
viewer component, that can be used to render tons of shit, and
virtualize really nicely

* Add APIs for rendering annotations

* Fix some bugs in annotations in the virtualizer process

* Refactor sticky logic for new CodeViewer world

Adding some new specs for the how to control layout/padding and how it
gets calculated.

At a high level basically we are using margins on the overall height
container to define padding (this makes it much easier to figure out
sticky state).  Then we have a new custom property for gap between
files/diffs, which utilizes flex gap for layout.

This also simplifies a bunch of the math which is quite nice.

Next up we need to rename `fileGap` since it's really now more of an
internal padding thing

* Fix up /gh route for new CodeViewer world

* fileGap -> spacing

* Update docs

* Adding some doc comments n shiii

* phase 1: core api cleanup

some ai slop, and some ai iteration to get things potentially setup for
the react component.

* Refactors CodeViewer APIs to support new incoming data structurs n stuff...

* ResizeManager: misc performance improvements

The main goal here was a bit of a sidequest to get CodeViewer more
performant by doing a better job of batching various dom operations to
hopefully alleviate unneeded layouts in heavy updates.

This is not a perfect solution, but I think on it's own it might offer a
solid number of improvements.

* foundational improvements:

* optimize cleanup
  * The aggressive innerHTML/textContent cleanups are probably not
    necessary and can add much unneeded overhead under aggressively
    scrolled situations
* apis to allow manager setups to be deferred (to avoid some layout
  thrashing)
  * enableLineSelection does cause some thrash if there are no
    selections, so we should look into muxing that prop in better
    instead of applying it as a dom write after the update...

* useless changes to UniversalRenderingManager

* CodeViewer React Component

Alright, this one was definitely a doozy, I had to add a lot of stuff to
be able to properly support react components, but I think that also
it'll really help out with the vanilla JS implementations.

I will probably need to eventually add a good testbed for CodeViewer
vanilla js as well so we can easily go between.

This does not include a more imperative implementation for data right
now, forcing user to manually update the entire data structure... which
isn't great. That might be the next case that I'll want to utilize

* Fix renderCustomMetadata on file to renderHeaderMetadata

Wasn't matching diffs, lol, what a flub

* Implement all callbacks and overloads

* Hook up renderGutterUtility properly

Also remove a bunch of the deprecated HoverUtility stuff

* Internal versioning system to better emit state updates in the future

* bugfix: regression of line annotation rows having a min-height

* Dont cursor the number column when interactive

* mb update nextjs

* Basic commenting and new layout system

* WIP before the scrollTo AI Storm

* update trees based on hustle work by the team

unclear if this is the right way, but it appears to work for now

* Fixed scrollTo item API

There were a bunch of issues unfortunately around fitPerfectly
calculations and also misc problems with scroll anchoring that this
change mostly resolves (I think).

* FileTree Polish

* Ensure a custom tree is only built on fetch (not on annotation change
  like before)
* Hooked up git status to make the list more descriptive
* Misc rebase fixes

file tree refactor fix

* First pass that new scrollTo architecture (to support smooth scroll)

* Working Smooth ScrollTo, lfgggg

* Improved math only scroll fix logic

Less DOM thrash, better mental model for virtualization, and can work in
noisier situations when animating scroll

* mdo specialty: tightening up the density of the file tree

* Add sticky header support for line/position scrollto stuff

* Initial pass at adding comment list/scroll too navigation

* Add `smooth-auto` behavior

A quick algo that will fall back to instant if the distance is more than
10 viewports away

* Fix filetree sort to match the patch file order

Seems to work great, and requires minimal work... lfgggg

* Trees: fix search from local library updates

* Apply scroll fixing when setOptions is called

fix a legit bug in scroll anchor

things were falling back to the file/item when a line wasn't fully visible

* sidequest: fix CodeViewer constructor setup

* add `stickyHeader` props to File/FileDiff

A mix of a feature request probably and the ability to make CodeViewer
far more elegant in handling of sticky headers

* codeviewer anchor fix: favor deletion lines over addition lines

makes the changes much more stable

* CodeViewer perf optimization on setOptions

calling instanceChanged on setOptions is probably not worth it since we
control the lifecycle with CodeViewer

* Massive anchoring refactor/improvements

* Adds a new stickyHeaders prop to CodeViewer
* Found a ton of issues in the numeric version of scroll anchoring, that
  should hopefully now be resolved.
* Fixed a ton of misc issues related to how different alignments worked
* Fixed tons of bugs with setOptions triggering pendingLayoutAnchor
* Fixed a bug where maxScroll did not include padding

* header fix

* Fix (and test) potential bug with mismatched trim columns

mb fix flakey test?

Actually fix the column out of sync bug

squash me

* implement new more customizeable virtualization metrics

* Adding paddingTop/Bottom that add flexibility as well remain backwards
  compatible

* Initial pass at a universal selection manager

Along with proper controlled selection behavior

* hacky controlled selection test

* Tweaks to comment ux to add ranges and stufffff

* Make the options a shared type

* Quick hack to disable syntax highlighting on massive files/diffs

* Make patch fetcher be plain text only

doing json stuff for this type of thing is not the jam, unfort

* fix broken test

* Disable pointer events while scrolling

optimize pointer events to sticky container

* docs v1

* Suggested commit message:
Improve GH viewer mobile experience

Adds a mobile file tree overlay with backdrop/close controls, keeps GH
viewer scroll panes from chaining to body scroll, and syncs
split/unified mode with the mobile breakpoint. Also lowers worker pool
and AST LRU cache limits on mobile browsers.

Staged changes include:
- GH page responsive grid and mobile file tree sheet.
- Mobile header action row with file tree toggle.
- Backdrop and close button owned by CodeViewerSidebar.
- Overscroll containment for code viewer, file tree, and comments panes.
- Responsive split/unified switching at 767px.
- Mobile-aware worker pool/cache limits.

* Move WorkerPoolStatus into sidebar

Also changed it to CodeViewer Status

* Add commit hashes as top level folders

* sticky headers are cool for the file tree

* nothingburger

* Redo item file selection

the llm did some crazy dom checking stuff that wasn't necessary, and
exhibited a few bugs

* First pass at supporting collapsed with CodeViewer

* Add collapse-y boi to /gh

* Fix `getAdvancedStickySpecs` when collapsed

* Improve instance apis and such for collapsing behavior.

* getWindowSpecs was a dumb thing to add a handle for
* Improve instance APIs to better allow scroll fixing on collapse changes
* Add further tests to it all

* Add scroll fix UX to collapse actions

* Don't modify the built in item version, lol

* Auto collapse files by default

* Collapse mega files by default...

* Attempt to setup a sort of test harness thing to see if we can optimize
shit...

* Fix a couple broken contain settings

* Some poor mans AI research on performance

* CodeViewer -> CodeView

Basically beta release prep, simplifying the name and all that

* Add a regression test...

* Fix theme style override in CodeView

* Add CodeView to demo app

This gives us a vanilla js implementation to poke around with

* Properly dispose of highlighter after any tests that use them

I think this can sometimes result in flakey tests

* Fix needless layout calculations

* some performance optimization on pathologically large files/hunks

Basically we create some computation checkpoints to start calculating
things from so we don't have to re-compute everything

---------

Co-authored-by: Mark Otto <[email protected]>
* clean up the vibe slop for the initial CodeView demo

* perf
update homepage, remove view from URL
revert old gh page to the old old version

I think it's a bit more obvious how it'll work for demo cases
* Fix WorkerPool

Needed to make sure the pool has time to spin up and be part of both the
home page and route page

* Bunch of polish for DiffsHub stuff

* Some spacing/alignment tweaks
* Trying out some crazy shit with sticky headers and stuff
* Custom scrollbars all around

* diffshub updates

- Remove new link on view page
- Link the logo and animate it on hover on view page
- Match homepage submit button to the view page

---------

Co-authored-by: Mark Otto <[email protected]>
* Add scroll anchor regression test

* Fix a scroll fix if container grows

in certain cases when re-computing scroll position for an anchor, we'd
need to move to a scroll position that's not yet valid, and therefore
the pre-mutate position fix would fail because the scroll position would
get inherently clamped.

Now we adjust the height of the scroll region first, then pre-scroll
fix, then mutate/render to ensure it works properly

* pr review fix
mdo and others added 17 commits May 7, 2026 19:50
* add aria label

* add another static one here
* Make CodeView scrollbar bigger

* Misc style/layout tweks

* Reduce padding under search bar
* Clean up how classes are applied to the main components
  * Grid stuff gets passed through, everything else should be probably
    part of the component itself

* Tweaks to the scrollbar

* some old placeholder code
* CodeView: unlimited paged scroller

This change still needs some more testing and review, but it does
essentially allow for a lot larger diffs in general by sorta creating
these massive/paged scroll views that automatically page as we go...

pick me out...

* Fix for Firefox sticky headers
* new unlimited page size scroller
* fix a bug with firefox sticky headers
Fix getTopForItem API

It was not including paddingTop which was causing some issues...
* Make logo respond to color modes

* Match home form button to view
* Better support flattened changes

* Refactor API to use .diff (but maintain .patch compat)

* Add diff stats

* Rework fetching into an improve system

* Rename GHViewer to ReviewUI

* Fix diffIndicators triggering UI updates on change in CodeView

That's what i get for not testing all my features, :kek:

* Added a new proper export type for DiffIndicators
  * Updated areas in the codebase that used the inline stuff
* Refactored virtualization logic a bit for setOptions and how it it can
  manage updates
  * Hopefully more future proof and cleaner code to reason about

* Add support for setting diffIndicators in diffshub

* tweak styles for folders

* Improve error and fetching states

* Revamp stats and monitor

* new home faq for examples

* Smol mb tweak to diff stats?

* Streaming Tests (#640)

* Improve React/VanillaJS APIs for streaming scenarios

* First version of streaming diff system...

it's really sorta slopped in terms of how code is organized and used, a
lot of inline shit and a lot to wrap my head around.

The real fix would be a sort of class based imperative system for
managing state, that can expose apis and stuff for more performant mutations.

* Refactor streaming system into usePatchLoader

This at least organizes/hides some of the craziness

* Implement new imperative APIs for CodeView, and make it an option in React

Much better performance, a lot less fuckery

* Remove old max line check (it no longer matters)

* PR feedback that wasn't real, despite AI really wanted to `well actually` me

* Update docs for new imperative APIs for CodeView

* Add support for githubusercontent.com

* improve url examples

* Rewrite url to more reflect new API

* Fix potential bug with trailing slashes

* Fix WorkerPool rendering race condition

Don't allow the diffs to render if the worker pool is not initialized

* Fix staggered loading

* Fix loading state bug with new workerPool status

* Harden managing worker pool state

---------

Co-authored-by: Mark Otto <[email protected]>
* Bunch of performance improvements and a new imperative API
* Add support for tangled.org

Freed up a lot of github specific code, and potentially should make
future additions of other services a lot easier...

* Fix for review
* chore: empty commit

* Misc UI updates and homepage edits

- Better mobile styles by assuming full width
- Update homepage to surface quick URLs more easily
- Improve responsive homepage design
- Turn sidebar into a sheet instead of a drawer on mobile in diff view

* fix some casing, not all; update some descriptions

* remove

* Responsive improvements

* Better responsive header component

* More better responsive yet again, this time with bg changes

---------

Co-authored-by: Amadeus Demarzi <[email protected]>
* Phase 1: Add support for scrollTo on selection ranges

* Phase 2: tests!

* Phase 3: getting hashing hooked up to selection

* First pass at hash linking to lines/ranges

* cleaner id syntax now

* Prettify the url encoding a bit

* Fix collapse/expansion if no content (disable it and show collapsed)

* PR review fix
* Restyle comment form and comment

* better comments and comment lists

* border tweak

* Avatars coming at you

* Review feedback

* update apple icons while here
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.

2 participants