技巧

GitHub 讲解如何在 Copilot 应用里重做 PR 视图的渲染

精选理由

GitHub 工程师拆解了 Copilot 应用里 PR 视图怎么重做的,评论区高度为啥难搞讲得很细,做前端渲染的可以看看思路。

GitHub 团队分享了在 GitHub Copilot 应用中重建 PR 视图的过程。团队称渲染百万行 diff 反而是简单部分,真正麻烦的是评论区域。评论高度受 markdown 换行、展开的 details、打开的回复框和未加载完的图片影响,这些只有渲染后才能知道。这条线程逐步展开他们的具体做法。

原文 · GitHub

Rendering a million-line diff is the easy part. 👀 Comments are what break it. Their height depends on markdown wrapping, expanded details, open reply boxes, and images still loading (none of which you know until you render). Here's how we rebuilt the PR view in the GitHub Copilot app 🧵 💬 8 🔄 1 ❤️ 30 👀 7674 📊 9 ⚡