mirror of
https://seed.radicle.dev/rad:z4D5UCArafTzTQpDZNQRuqswh3ury.git
synced 2026-11-21 02:30:45 +08:00
Keep the view steady when reacting or commenting
Bind each cached loader to a `{@const}` so the `{#await}` blocks keep
the same promise across patch reloads instead of re-running and
flashing their pending branch.
This commit is contained in:
committed by
Rūdolfs Ošiņš
parent
7cea431306
commit
ba5e571337
@@ -136,8 +136,15 @@
|
||||
|
||||
{#if path}
|
||||
<!-- The file's own patch text, which is all the renderer needs; the structured
|
||||
diff is not fetched here at all. -->
|
||||
{#await cachedGetDiffText(rid, base, head, 3, path)}
|
||||
diff is not fetched here at all.
|
||||
|
||||
Bound to a `{@const}` (a derived) rather than called inside the
|
||||
`{#await}`: a patch reload replaces the props this reads, and an inline
|
||||
call would re-run the block, flashing the pending branch and jumping the
|
||||
scroll position. The derived returns the same cached promise, so it
|
||||
does not. -->
|
||||
{@const filePatchPromise = cachedGetDiffText(rid, base, head, 3, path)}
|
||||
{#await filePatchPromise}
|
||||
<div class="fallback">Loading code…</div>
|
||||
{:then filePatch}
|
||||
<div class="wrapper">
|
||||
|
||||
Reference in New Issue
Block a user