Skip to content

Commit 2022697

Browse files
committed
refactor(ui): replace direct Rendering store with MarkWritten() call
- Use `RequestWriter.MarkWritten()` instead of directly storing to `rw.Rendering` - Update comment to clarify that `Write` records the write instant via `MarkWritten()` - Remove outdated test assertion for `rendering=true`, as it's now covered by core package tests Signed-off-by: Johan Lindh <johan@linkdata.se>
1 parent 7c9a3bc commit 2022697

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎lib/ui/requestwriter.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ func (rw RequestWriter) NewUI(ui jaws.UI, params ...any) (err error) {
2222
return
2323
}
2424

25-
// Write records that rendering has started, then writes p to the underlying writer.
25+
// Write records the write instant (see [jaws.Request.MarkWritten]), then writes p
26+
// to the underlying writer.
2627
func (rw RequestWriter) Write(p []byte) (n int, err error) {
27-
rw.Rendering.Store(true)
28+
rw.MarkWritten()
2829
return rw.Writer.Write(p)
2930
}
3031

‎lib/ui/requestwriter_test.go‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ func TestRequestWriter_MethodsAndWidgetHelpers(t *testing.T) {
4343
if got := buf.String(); got != "prefix" {
4444
t.Fatalf("unexpected write output %q", got)
4545
}
46-
if !rq.Rendering.Load() {
47-
t.Fatal("expected rendering=true after write")
48-
}
46+
// Write records the write instant via Request.MarkWritten (covered by the core
47+
// package's pending-eviction tests); lastWriteNano is unexported here.
4948

5049
if rw.Initial() == nil {
5150
t.Fatal("expected initial request")

0 commit comments

Comments
 (0)