When a pinned element came from a component that the PR changes, the pin is posted as a review comment on that file and line, next to the code, not in the PR conversation. This needs the source plugin (@assuncaocharles/pinback-source-plugin) in your preview builds. Without it, every pin is a plain PR comment.
In preview builds, the Vite plugin adds data-pp-src="<repo-relative path>:<line>:<col>" to every host JSX element (<div>, <button>…). Components (<Card>, <motion.div>) are left alone because they may not forward the attribute to the DOM. Paths are relative to the git root, so they match the PR diff.
A pin stores the nearest data-pp-src of the clicked element as anchor.source.
When the pin is posted, the auth frame lists the PR's changed files (GET /pulls/{n}/files) and applies the rules below.
Replies to a review-comment pin are posted as native review replies (POST /pulls/{n}/comments/{id}/replies), so they stay in the thread on GitHub. Replies typed in GitHub's own review UI show up in the widget too.
Resolved state: when signed in, the widget reads GitHub's review-thread isResolved (GraphQL), which wins over pinback state events. Resolving or reopening from the widget posts a state event and resolves or unresolves the GitHub thread, so both sides agree. Anonymous readers rely on the state events (ADR 5).
A review comment whose code later changes shows as "outdated" on GitHub, just like any review comment. In the preview, its pin follows the element through M3 anchoring, where source is the strongest signal.
The plugin is off unless PREVIEW_PINS=1 is set (or enabled: true), so production builds are untouched. Set repoRoot if the git root can't be found from the Vite root.
Source-line comments
When a pinned element came from a component that the PR changes, the pin is posted as a review comment on that file and line, next to the code, not in the PR conversation. This needs the source plugin (
@assuncaocharles/pinback-source-plugin) in your preview builds. Without it, every pin is a plain PR comment.How the line is found
data-pp-src="<repo-relative path>:<line>:<col>"to every host JSX element (<div>,<button>…). Components (<Card>,<motion.div>) are left alone because they may not forward the attribute to the DOM. Paths are relative to the git root, so they match the PR diff.data-pp-srcof the clicked element asanchor.source.GET /pulls/{n}/files) and applies the rules below.Rules
element at path:lineReview comments always target
commit_id= the commit the preview was built from, on theRIGHTside.Threads, replies and resolving
POST /pulls/{n}/comments/{id}/replies), so they stay in the thread on GitHub. Replies typed in GitHub's own review UI show up in the widget too.isResolved(GraphQL), which wins over pinback state events. Resolving or reopening from the widget posts a state event and resolves or unresolves the GitHub thread, so both sides agree. Anonymous readers rely on the state events (ADR 5).sourceis the strongest signal.Setup
The plugin is off unless
PREVIEW_PINS=1is set (orenabled: true), so production builds are untouched. SetrepoRootif the git root can't be found from the Vite root.