Repository navigation
[refactor] Extract usePaginatedQuery for the Credits usage table - #15602
claude[bot] wants to merge 13 commits into
Conversation
Illustrative refactor for an architecture discussion, per docs/guidance/state-and-effects.md. Rebased onto main now that #15151 has merged (as 7494f71) and FE-1609 (#15239) added an `embedded` prop to CreditsPanel in the meantime. - UsageLogsTable owned pagination as a mutable {page, limit, total, totalPages} ref written from three places (a click handler, refresh(), and the server response echo), plus a hand-rolled loadToken race guard duplicated per-component. - CreditsPanel, and separately PlanCreditsPanelContent, each drove a reload by reaching into UsageLogsTable via a template ref and calling an exposed refresh() method. usePaginatedQuery now owns page/limit/total/first as computed values derived from the last response (one source of truth, not several fields kept in sync by hand), bakes the request-token guard in once, and resets/refetches through a single reactive `key`. UsageLogsTable loads itself on mount (no external refresh() needed); CreditsPanel passes a plain `refetchKey` prop instead of imperatively calling into the child, and PlanCreditsPanelContent's now-redundant refresh-on-mount is removed. Behavior is unchanged: same initial load, same refresh triggers, same error messages.
e04f809 to
85ded15
Compare
🎭 Playwright: ✅ 2039 passed, 0 failed · 1 flaky📊 Browser Reports
🎨 Storybook: ✅ Built — View Storybook📦 Bundle: 9.92 MB gzip 🔴 +525 BDetailsSummary
Category Glance App Entry Points — 3.77 kB (baseline 3.77 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 1.45 MB (baseline 1.45 MB) • ⚪ 0 BGraph editor runtime, canvas, workflow orchestration
Status: 2 added / 2 removed / 1 unchanged Views & Navigation — 132 kB (baseline 132 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 14 added / 14 removed / 4 unchanged Panels & Settings — 638 kB (baseline 637 kB) • 🔴 +1.05 kBConfiguration panels, inspectors, and settings screens
Status: 10 added / 10 removed / 17 unchanged User & Accounts — 37.9 kB (baseline 37.9 kB) • ⚪ 0 BAuthentication, profile, and account management bundles
Status: 6 added / 6 removed / 5 unchanged Editors & Dialogs — 126 kB (baseline 126 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 7 added / 7 removed / 1 unchanged UI Components — 124 kB (baseline 124 kB) • ⚪ 0 BReusable component library chunks
Status: 7 added / 7 removed / 9 unchanged Data & Services — 3.86 MB (baseline 3.86 MB) • 🔴 +508 BStores, services, APIs, and repositories
Status: 13 added / 13 removed / 3 unchanged Utilities & Hooks — 565 kB (baseline 565 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 19 added / 19 removed / 19 unchanged Vendor & Third-Party — 17.4 MB (baseline 17.4 MB) • ⚪ 0 BExternal libraries and shared vendor chunks Status: 18 unchanged Other — 17.7 MB (baseline 17.7 MB) • 🟢 -16 BBundles that do not match a named category
Status: 73 added / 73 removed / 224 unchanged ⚡ Performance Report
Show regressions
All metrics
Historical variance (last 15 runs)
Trend (last 15 commits on main)
Raw data{
"timestamp": "2026-09-19T03:52:50.392Z",
"gitSha": "1803afe4481d5738adf5c275d0089d531ea5089a",
"branch": "refactor/usage-table-paginated-query",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2008.531000000005,
"styleRecalcs": 9,
"styleRecalcDurationMs": 6.338,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 378.6649999999999,
"heapDeltaBytes": 13947884,
"heapUsedBytes": 75918008,
"domNodes": -262,
"jsHeapTotalBytes": 5234688,
"scriptDurationMs": 9.176999999999998,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-idle",
"durationMs": 1988.7689999999907,
"styleRecalcs": 9,
"styleRecalcDurationMs": 6.854000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 368.142,
"heapDeltaBytes": -6789664,
"heapUsedBytes": 55368544,
"domNodes": -262,
"jsHeapTotalBytes": 4448256,
"scriptDurationMs": 8.407,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1741.1760000000527,
"styleRecalcs": 74,
"styleRecalcDurationMs": 23.787999999999997,
"layouts": 14,
"layoutDurationMs": 4.4190000000000005,
"taskDurationMs": 693.351,
"heapDeltaBytes": 13136872,
"heapUsedBytes": 75097848,
"domNodes": -263,
"jsHeapTotalBytes": 5496832,
"scriptDurationMs": 125.941,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1723.4050000000138,
"styleRecalcs": 75,
"styleRecalcDurationMs": 23.100999999999996,
"layouts": 14,
"layoutDurationMs": 3.985,
"taskDurationMs": 694.24,
"heapDeltaBytes": -77708,
"heapUsedBytes": 62058876,
"domNodes": -260,
"jsHeapTotalBytes": 5496832,
"scriptDurationMs": 123.484,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1768.8019999999938,
"styleRecalcs": 31,
"styleRecalcDurationMs": 17.856000000000005,
"layouts": 6,
"layoutDurationMs": 1.218,
"taskDurationMs": 308.62300000000005,
"heapDeltaBytes": 2127688,
"heapUsedBytes": 64071604,
"domNodes": 76,
"jsHeapTotalBytes": 4980736,
"scriptDurationMs": 12.402,
"eventListeners": 15,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1710.0320000000693,
"styleRecalcs": 30,
"styleRecalcDurationMs": 12.746,
"layouts": 6,
"layoutDurationMs": 0.98,
"taskDurationMs": 256.12500000000006,
"heapDeltaBytes": 2093296,
"heapUsedBytes": 64268364,
"domNodes": 75,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 9.762000000000002,
"eventListeners": 15,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 544.3899999999644,
"styleRecalcs": 12,
"styleRecalcDurationMs": 7.366,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 359.11899999999997,
"heapDeltaBytes": 16852836,
"heapUsedBytes": 77755424,
"domNodes": 19,
"jsHeapTotalBytes": 5505024,
"scriptDurationMs": 127.19500000000001,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666682,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "dom-widget-clipping",
"durationMs": 563.4840000000167,
"styleRecalcs": 12,
"styleRecalcDurationMs": 7.892999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 384.46700000000004,
"heapDeltaBytes": 17897428,
"heapUsedBytes": 79861132,
"domNodes": 19,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 137.73200000000003,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-idle",
"durationMs": 2023.9700000000198,
"styleRecalcs": 8,
"styleRecalcDurationMs": 6.783000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 504.4929999999999,
"heapDeltaBytes": 573088,
"heapUsedBytes": 79371964,
"domNodes": -246,
"jsHeapTotalBytes": 778240,
"scriptDurationMs": 30.423000000000005,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2016.3909999999987,
"styleRecalcs": 5,
"styleRecalcDurationMs": 3.7519999999999984,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 447.9900000000001,
"heapDeltaBytes": 1004088,
"heapUsedBytes": 82059360,
"domNodes": -247,
"jsHeapTotalBytes": -1282048,
"scriptDurationMs": 27.773,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-pan",
"durationMs": 2165.685999999994,
"styleRecalcs": 67,
"styleRecalcDurationMs": 11.608999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1310.419,
"heapDeltaBytes": 14823952,
"heapUsedBytes": 78697800,
"domNodes": -246,
"jsHeapTotalBytes": 749568,
"scriptDurationMs": 658.845,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-pan",
"durationMs": 2131.2980000000152,
"styleRecalcs": 69,
"styleRecalcDurationMs": 12.588999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1270.855,
"heapDeltaBytes": -6381300,
"heapUsedBytes": 75360488,
"domNodes": -242,
"jsHeapTotalBytes": -794624,
"scriptDurationMs": 652.916,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 3334.8589999999945,
"styleRecalcs": 62,
"styleRecalcDurationMs": 11.196000000000002,
"layouts": 60,
"layoutDurationMs": 12.933000000000002,
"taskDurationMs": 1480.225,
"heapDeltaBytes": 9114056,
"heapUsedBytes": 74392224,
"domNodes": -255,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 683.218,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 3141.508999999928,
"styleRecalcs": 64,
"styleRecalcDurationMs": 11.898,
"layouts": 60,
"layoutDurationMs": 11.953,
"taskDurationMs": 1320.8829999999998,
"heapDeltaBytes": 8800892,
"heapUsedBytes": 74287868,
"domNodes": 10,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 618.253,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "legacy-node-drag",
"durationMs": 2185.094000000049,
"styleRecalcs": 42,
"styleRecalcDurationMs": 6.1049999999999995,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1491.316,
"heapDeltaBytes": 5218632,
"heapUsedBytes": 71279400,
"domNodes": 4,
"jsHeapTotalBytes": 262144,
"scriptDurationMs": 760.3069999999999,
"eventListeners": 180,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "legacy-node-drag",
"durationMs": 2226.709000000028,
"styleRecalcs": 43,
"styleRecalcDurationMs": 6.321999999999997,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1478.0259999999998,
"heapDeltaBytes": 5481076,
"heapUsedBytes": 70489808,
"domNodes": 6,
"jsHeapTotalBytes": 262144,
"scriptDurationMs": 759.5730000000001,
"eventListeners": 180,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "minimap-idle",
"durationMs": 2027.0549999999616,
"styleRecalcs": 7,
"styleRecalcDurationMs": 9.300000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 512.316,
"heapDeltaBytes": -11601464,
"heapUsedBytes": 75491184,
"domNodes": -262,
"jsHeapTotalBytes": -495616,
"scriptDurationMs": 33.44699999999999,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "minimap-idle",
"durationMs": 2035.4630000000498,
"styleRecalcs": 8,
"styleRecalcDurationMs": 6.074999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 473.9220000000001,
"heapDeltaBytes": -6257272,
"heapUsedBytes": 81290516,
"domNodes": -244,
"jsHeapTotalBytes": -1282048,
"scriptDurationMs": 29.759999999999994,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 521.4090000000056,
"styleRecalcs": 48,
"styleRecalcDurationMs": 9.383000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 315.25000000000006,
"heapDeltaBytes": 13149860,
"heapUsedBytes": 76364412,
"domNodes": 22,
"jsHeapTotalBytes": 5505024,
"scriptDurationMs": 113.29999999999998,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666682,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 505.82599999995637,
"styleRecalcs": 47,
"styleRecalcDurationMs": 9.117999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 313.007,
"heapDeltaBytes": 13166104,
"heapUsedBytes": 76495148,
"domNodes": 20,
"jsHeapTotalBytes": 5767168,
"scriptDurationMs": 113.776,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.669999999999998,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-idle",
"durationMs": 1991.6869999999562,
"styleRecalcs": 10,
"styleRecalcDurationMs": 7.462,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 382.283,
"heapDeltaBytes": 17724744,
"heapUsedBytes": 80586736,
"domNodes": -275,
"jsHeapTotalBytes": 4710400,
"scriptDurationMs": 7.877000000000001,
"eventListeners": -198,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-idle",
"durationMs": 1992.668999999978,
"styleRecalcs": 11,
"styleRecalcDurationMs": 7.785000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 366.025,
"heapDeltaBytes": -2011108,
"heapUsedBytes": 61290128,
"domNodes": -275,
"jsHeapTotalBytes": 4710400,
"scriptDurationMs": 7.0200000000000005,
"eventListeners": -220,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1707.8420000000278,
"styleRecalcs": 78,
"styleRecalcDurationMs": 28.760999999999996,
"layouts": 18,
"layoutDurationMs": 5.993,
"taskDurationMs": 693.63,
"heapDeltaBytes": 16250056,
"heapUsedBytes": 79326764,
"domNodes": -276,
"jsHeapTotalBytes": 4186112,
"scriptDurationMs": 94.284,
"eventListeners": -198,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1687.7880000000118,
"styleRecalcs": 79,
"styleRecalcDurationMs": 25.127,
"layouts": 18,
"layoutDurationMs": 5.241,
"taskDurationMs": 649.1080000000001,
"heapDeltaBytes": 611724,
"heapUsedBytes": 63874064,
"domNodes": -272,
"jsHeapTotalBytes": 6545408,
"scriptDurationMs": 91.532,
"eventListeners": -220,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-transition-enter",
"durationMs": 867.3479999999927,
"styleRecalcs": 18,
"styleRecalcDurationMs": 22.271,
"layouts": 5,
"layoutDurationMs": 9.418,
"taskDurationMs": 707.3499999999999,
"heapDeltaBytes": 20023120,
"heapUsedBytes": 102613836,
"domNodes": 13587,
"jsHeapTotalBytes": 11010048,
"scriptDurationMs": 22.230999999999995,
"eventListeners": 2383,
"totalBlockingTimeMs": 92,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "viewport-pan-sweep",
"durationMs": 8641.242999999975,
"styleRecalcs": 250,
"styleRecalcDurationMs": 38.134,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 5064.572,
"heapDeltaBytes": -13580912,
"heapUsedBytes": 64986344,
"domNodes": -251,
"jsHeapTotalBytes": 1564672,
"scriptDurationMs": 2421.4449999999997,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8168.503999999984,
"styleRecalcs": 249,
"styleRecalcDurationMs": 36.3,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4422.057000000001,
"heapDeltaBytes": -5709684,
"heapUsedBytes": 75374408,
"domNodes": -244,
"jsHeapTotalBytes": -270336,
"scriptDurationMs": 2119.072,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 14468.78700000002,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 14168.614,
"heapDeltaBytes": -12672332,
"heapUsedBytes": 196946964,
"domNodes": -8061,
"jsHeapTotalBytes": -10002432,
"scriptDurationMs": 200.407,
"eventListeners": -14928,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.77333333333336,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-idle",
"durationMs": 13990.912999999979,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 13594.42,
"heapDeltaBytes": -41302208,
"heapUsedBytes": 194242184,
"domNodes": -8062,
"jsHeapTotalBytes": -10465280,
"scriptDurationMs": 206.42699999999996,
"eventListeners": -14928,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.223333333333237,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 16953.168000000005,
"styleRecalcs": 121,
"styleRecalcDurationMs": 14.858999999999984,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 16813.125,
"heapDeltaBytes": -36075332,
"heapUsedBytes": 177815148,
"domNodes": -8061,
"jsHeapTotalBytes": -13824000,
"scriptDurationMs": 728.872,
"eventListeners": -14928,
"totalBlockingTimeMs": 19,
"frameDurationMs": 17.223333333333358,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 16738.265999999952,
"styleRecalcs": 127,
"styleRecalcDurationMs": 12.985999999999997,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 16464.88,
"heapDeltaBytes": -36648392,
"heapUsedBytes": 191877576,
"domNodes": -8062,
"jsHeapTotalBytes": -10539008,
"scriptDurationMs": 671.056,
"eventListeners": -14928,
"totalBlockingTimeMs": 5,
"frameDurationMs": 17.223333333333358,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-node-resize-workload",
"durationMs": 5241.269000000046,
"styleRecalcs": 20,
"styleRecalcDurationMs": 65.117,
"layouts": 20,
"layoutDurationMs": 23.064,
"taskDurationMs": 5193.6320000000005,
"heapDeltaBytes": -49871460,
"heapUsedBytes": 169825028,
"domNodes": -8061,
"jsHeapTotalBytes": 9764864,
"scriptDurationMs": 87.761,
"eventListeners": -14928,
"totalBlockingTimeMs": 210,
"frameDurationMs": 17.216666666666665,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-node-resize-workload",
"durationMs": 4976.947999999993,
"styleRecalcs": 20,
"styleRecalcDurationMs": 61.20699999999999,
"layouts": 20,
"layoutDurationMs": 21.815,
"taskDurationMs": 4919.625,
"heapDeltaBytes": -44804516,
"heapUsedBytes": 170891136,
"domNodes": -8062,
"jsHeapTotalBytes": 12804096,
"scriptDurationMs": 80.203,
"eventListeners": -14928,
"totalBlockingTimeMs": 249,
"frameDurationMs": 17.773333333333298,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-zoom-out-idle",
"durationMs": 7175.624000000027,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 7078.042999999999,
"heapDeltaBytes": 8521716,
"heapUsedBytes": 186564208,
"domNodes": 0,
"jsHeapTotalBytes": -8912896,
"scriptDurationMs": 101.49799999999998,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-zoom-out-idle",
"durationMs": 7078.358000000094,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 6906.574999999998,
"heapDeltaBytes": 4828504,
"heapUsedBytes": 190015004,
"domNodes": 0,
"jsHeapTotalBytes": -11534336,
"scriptDurationMs": 101.12499999999997,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.223333333333358,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "workflow-execution",
"durationMs": 97.16400000002068,
"styleRecalcs": 7,
"styleRecalcDurationMs": 15.587,
"layouts": 3,
"layoutDurationMs": 1.412,
"taskDurationMs": 73.41799999999999,
"heapDeltaBytes": 3175700,
"heapUsedBytes": 64770868,
"domNodes": 129,
"jsHeapTotalBytes": 262144,
"scriptDurationMs": 6.908999999999999,
"eventListeners": 17,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666682,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "workflow-execution",
"durationMs": 72.49799999999595,
"styleRecalcs": 5,
"styleRecalcDurationMs": 10.972000000000001,
"layouts": 3,
"layoutDurationMs": 1.3119999999999998,
"taskDurationMs": 53.400999999999975,
"heapDeltaBytes": 3022656,
"heapUsedBytes": 64649796,
"domNodes": 122,
"jsHeapTotalBytes": 524288,
"scriptDurationMs": 4.705000000000001,
"eventListeners": 17,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
}
]
}🔬 E2E Coverage
Top 10 files by uncovered lines
|
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #15602 +/- ##
==========================================
+ Coverage 82.77% 83.80% +1.03%
==========================================
Files 2936 2243 -693
Lines 144482 127651 -16831
Branches 39021 36812 -2209
==========================================
- Hits 119593 106983 -12610
+ Misses 23632 20378 -3254
+ Partials 1257 290 -967
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 701 files with indirect coverage changes 🚀 New features to boost your workflow:
|
dante01yoon
left a comment
There was a problem hiding this comment.
One blocking contract/complexity issue: the new generic composable recreates backend-owned pagination state that its only caller does not use. Please remove that derived surface or source it from the API contract.
totalPages was recomputed from total/limit, duplicating a value both billing APIs already return deterministically, and the only caller (UsageLogsTable) never consumed it. Removed it from the composable's public return instead of keeping unused, potentially drifting state.
dante01yoon
left a comment
There was a problem hiding this comment.
Verified the follow-up: totalPages and its test assertion were removed, so the composable no longer recreates that unused backend-owned pagination state. No further findings.
…eBillingContext
Per review feedback: defineExpose('refresh') on UsageLogsTable was a
legitimate stateless imperative command (no state to desync), so the
refetchKey-prop replacement was the wrong fix for the wrong problem.
Reverted UsageLogsTable to expose refresh() again via a template ref,
matching this repo's own defineExpose convention
(docs/guidance/vue-components.md, src/components/AGENTS.md,
.agents/checks/vue-patterns.md).
What still needed fixing was where the "should credits UI refresh"
decision lived: CreditsPanel had its own local watch(balance) +
revision counter, and PlanCreditsPanelContent had none at all (so a
top-up while on its Activity tab never refreshed that table). Moved
the skip-first-hydration balance-watch into useBillingContext as a new
exposed `usageLogsRefreshSignal`, the shared composable that already
owns `balance`. Both CreditsPanel and PlanCreditsPanelContent now just
watch that one signal and call their own table ref's refresh() -
the "when" lives once in the data layer; the "how" (an imperative
command) stays where Vue's defineExpose convention says it belongs.
usePaginatedQuery's page/limit/total derivation is unchanged - that
part was never in dispute.
|
Updated per feedback (Christian): reverted What actually needed fixing was where the "should credits UI refresh" decision lived — it was duplicated (and in Pushed as Generated by Claude Code |
…paginated-query # Conflicts: # src/components/dialog/content/setting/UsageLogsTable.vue
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Replace direct Error throws with a named PageRequestError subclass to satisfy the comfy/no-new-error-throw lint rule (ADR 0019 diagnostics policy).
…paginated-query # Conflicts: # src/components/dialog/content/setting/CreditsPanel.test.ts
dante01yoon
left a comment
There was a problem hiding this comment.
One blocking regression remains in the balance-driven activity refresh. The pagination extraction itself and the prior server-pagination concern look resolved.
…efreshSignal Both billing adapters rebuild their BalanceInfo object on every successful fetchBalance(), even when the values are unchanged, so watching balance by reference alone fired the refresh signal on every routine read (including legacy top-up polling), needlessly resetting a mounted activity table to page 1. Compare the stable value fields instead and only emit when one actually changed.
dante01yoon
left a comment
There was a problem hiding this comment.
Re-reviewed the follow-up change. The refresh signal now compares every stable BalanceInfo value, ignores identity-only refetches, and still bumps on a genuine balance change. The focused regression coverage and exact-head CI are green.
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
DrJKL
left a comment
There was a problem hiding this comment.
The production behavior looks sound, and the focused tests pass. One blocking test/lint issue remains below.
Non-blocking: usePaginatedQuery.test.ts never invokes the public refresh() command. A case that first loads page 2, awaits refresh(), and verifies a page-1 request would preserve the imperative compatibility contract.
Nit: usageLogsRefreshSignal is context-owned but exposed as a writable Ref<number>. Readonly<Ref<number>> would prevent consumers from forging balance-change events.
| const billingMocks = vi.hoisted(() => ({ | ||
| usageLogsRefreshSignal: { value: 0 } | ||
| })) | ||
| vi.mock('@/composables/billing/useBillingContext', async () => { |
There was a problem hiding this comment.
blocking: This new string-form mock violates vitest/prefer-import-in-mock. CI autofixes it to vi.mock(import(...)), then pnpm typecheck fails because the partial factory does not return a complete BillingContext. Please use the repository pattern for intentional partial module mocks: vi.mock<unknown>(import("@/composables/billing/useBillingContext"), async () => ...). This is the current lint-and-format failure on this exact head.
There was a problem hiding this comment.
Fixed in 0396be2 (fix: use vi.mock<unknown> for partial useBillingContext mock): switched to vi.mock<unknown>(import('@/composables/billing/useBillingContext'), async () => ...), this repo's established pattern for intentional partial billing-context mocks (see CreditsTile.test.ts). pnpm lint and pnpm typecheck are both clean on this file now.
Also picked up your two non-blocking notes from the same review:
usePaginatedQuery.test.tsnow has arefresh reloads page 1, preserving the imperative compatibility contracttest: loads page 2, awaitsrefresh(), and asserts the follow-up request is{ page: 1, ... }.usageLogsRefreshSignalis typedReadonly<Ref<number>>onBillingContext(src/composables/billing/types.ts), so consumers can watch it but can't forge a bump.
As the PR author I'm leaving this thread open per repo convention (AGENTS.md: resolving review comments is the reviewer's call) rather than resolving it myself — flagging for your re-review.
Generated by Claude Code
PlanCreditsPanelContent.test.ts mocked useBillingContext with a string-path vi.mock() call, which the lint autofix rewrites to the import()-form for vitest/prefer-import-in-mock. That form requires the factory's return type to satisfy the module's real type, but the factory only returns usageLogsRefreshSignal, so pnpm typecheck failed. Switch to vi.mock<unknown>(import(...), ...), this repo's established pattern for intentional partial billing-context mocks (see CreditsTile.test.ts).
…gnal type Adds a test case that loads page 2, awaits refresh(), and verifies a page-1 request is made, covering the imperative compatibility contract that was previously untested. Also changes usageLogsRefreshSignal's exposed type to Readonly<Ref<number>> so consumers can only read the context-owned balance-change signal, not write to it.
…paginated-query # Conflicts: # src/components/dialog/content/setting/CreditsPanel.test.ts
DrJKL
left a comment
There was a problem hiding this comment.
No P0/P1 findings on the reviewed merge-base diff. GitHub currently reports conflicts with main; conflict resolution must preserve the account-core event reader and active-workspace invalidation added by #18042.
Findings without an anchorable line
None.
Existing findings checked
- The unused
totalPagesresult is gone. - Balance refresh now compares all
BalanceInfofields instead of object identity. - The earlier string-form mock is now
vi.mock<unknown>(import(...)), and lint passes on this head. A separate inline finding covers the current guidance against adding new partial factories with this escape.
Unverified candidates
None.
Checked and cleared
- The apparent SDK-reader and workspace-switch regressions were not introduced by this PR. Commit
6a15cc1b4badded both tomainafter merge-basee39498b; they now appear as merge conflicts. - Keeping the refresh command at each parent is an explicit design choice in the PR and matches the repository's
defineExposeguidance for imperative operations. BillingContextis an internalsrccontract rather than a supported package API, so adding its required field does not contradict the PR's external breaking-change claim.- Initial pagination defaults are defined and tested; the docblock's last-response statement describes accepted response state.
- Exact-head GitHub checks for tests, lint/format, and Fallow passed. Local focused tests also passed 75/75.
- Fallow audited all 13 changed files and found no new issue in them.
Coverage
Standard-depth review. Correctness, maintainability, idiomaticity, tests, and documentation lanes ran across all 13 changed files. The lanes applied the standard billing/concurrency, blast-radius, regression-risk, TypeScript, Vue, test-quality, mock-quality, simplification, and technical-writing lenses. No Playwright or workflow files changed. Focused unit tests passed: 5 files, 75 tests. Exact-head CI is green, but the PR is merge-conflicted with current main.
| total: number | ||
| } | ||
|
|
||
| export class PageRequestError extends Error { |
There was a problem hiding this comment.
[P3] PageRequestError does not create the display-safe boundary its contract describes. The catch below surfaces every Error.message verbatim, and no consumer checks this class. Either surface only PageRequestError messages and replace unknown errors with a generic message, or remove the class and its special contract. As written, the name implies a safety distinction that the implementation does not enforce.
| } = usePaginatedQuery<AuditLog, boolean>({ | ||
| key: shouldUseWorkspaceBilling, | ||
| initialLimit: 7, | ||
| fetchPage: async ({ page, limit: requestedLimit }) => { |
There was a problem hiding this comment.
[P3] The composable snapshots key and passes it to this callback, but the only production consumer ignores that value and rereads shouldUseWorkspaceBilling.value. That leaves two definitions of request identity and makes the key parameter/tests misleading. Destructure the passed key here and use it to choose the backend.
| balance.value = makeBalance(9000) | ||
| await nextTick() | ||
| expect(refreshActivity).toHaveBeenCalledOnce() | ||
| ;(billing.usageLogsRefreshSignal as Ref<number>).value++ |
There was a problem hiding this comment.
[P3] This assertion removes the public Readonly<Ref<number>> contract just so the test can mutate it. Please drive the writable source through the typed mock instead. The Vitest guidance specifically permits vi.mocked(readonlyRef).value = ... for readonly reactive mock fields, which keeps this test checked against the real contract.
|
|
||
| let requestToken = 0 | ||
|
|
||
| const load = async (requestedPage: number) => { |
There was a problem hiding this comment.
[P3] Repository guidance says to use function declarations when possible. load, goToPage, and refresh can all be declarations without changing closure behavior; the new runInScope test helper has the same issue. Please convert these named helpers and leave only actual callbacks as expressions.
| import type { MaybeRefOrGetter } from 'vue' | ||
| import { computed, ref, shallowRef, toValue, watch } from 'vue' | ||
|
|
||
| export interface PageResult<T> { |
There was a problem hiding this comment.
[P3] PageResult is exported only for the colocated test; no production code imports the type. The engineering guidance asks composables to minimize exports. Keep this interface private and let the test infer its fixture/deferred result type instead of publishing a contract for test convenience.
| expect(api.loading.value).toBe(false) | ||
| }) | ||
|
|
||
| it('goToPage requests the new page and updates first/page from the response', async () => { |
There was a problem hiding this comment.
[P2] Every fixture echoes the requested page and limit, so these tests do not prove the main response-authoritative claim. An implementation that keeps the requested page or initialLimit would still pass. Return deliberately different page and limit values, assert page, limit, and first, then verify the next request uses the server-returned limit.
| await vi.waitFor(() => expect(context.balance.value).not.toBeNull()) | ||
| expect(context.usageLogsRefreshSignal.value).toBe(0) | ||
|
|
||
| vi.mocked(workspaceApi.getBillingBalance).mockResolvedValueOnce({ |
There was a problem hiding this comment.
[P2] The positive case changes only amountMicros. A comparator that omits currency, effective balance, prepaid balance, or cloud-credit balance still passes both new tests. Please table-drive one independently changed BalanceInfo field per case, plus the equal clone, so every field that should trigger an activity refresh is protected.
| renderPanel() | ||
|
|
||
| await userEvent.click(screen.getByRole('button', { name: 'Activity' })) | ||
| refreshUsageLogs.mockClear() |
There was a problem hiding this comment.
[P2] Clearing the mock here erases evidence of an unwanted refresh when Activity mounts. The old template-ref watcher plus the new signal watcher would pass this test and issue a duplicate request on every tab open. Assert no refresh immediately after opening Activity, then change the signal and assert exactly one call.
| expect(api.total.value).toBe(5) | ||
| }) | ||
|
|
||
| it('surfaces a thrown error message and stops loading', async () => { |
There was a problem hiding this comment.
[P3] This covers only a terminal rejection. It does not protect the retry transition or the promise contract of refresh(). After the initial rejection, start a deferred refresh and assert the old error clears, loading remains true, and the returned promise stays pending until that request settles.
| const billingMocks = vi.hoisted(() => ({ | ||
| usageLogsRefreshSignal: { value: 0 } | ||
| })) | ||
| vi.mock<unknown>( |
There was a problem hiding this comment.
[P3] docs/guidance/vitest.md reserves vi.mock<unknown> for legacy partial factories; this is a new mock. It drops module-level type checking for the billing-context wiring under test. Please activate the existing complete manual useBillingContext mock and configure its reactive field, rather than adding another partial factory escape.
dante01yoon
left a comment
There was a problem hiding this comment.
Re-review of the commits since my review on f28a94e1ba: 0396be2b3d (vi.mock<unknown> for the partial billing-context mock), 61d213310c (a refresh() test and Readonly<Ref<number>> for usageLogsRefreshSignal), and two merges of main.
My earlier findings: both still fixed
totalPagesre-derivation: removed inc42f753.- Identity-only balance refetches firing the refresh signal:
balanceValuesEqual()ina828ff5.
New commits: no findings from me. The refresh() test checks that page 2 goes back to a page-1 request, and making the signal readonly to consumers is a good tightening. I'm not repeating DrJKL's Sep 20 inline review; those threads are theirs to close.
Branch state: the branch conflicts heavily with main and needs a real rebase. main has since deleted or moved UsageLogsTable.vue (and its test), src/composables/billing/types.ts, useBillingContext.test.ts, and src/platform/workspace/.../PlanCreditsPanelContent.vue, and the panel tests now live under src/platform/billing/... and src/platform/account/.... So the extraction has to be re-applied in the new locations.
Approving on my findings. The rebase and DrJKL's open review still stand between this and merge.
Requested by Christian Byrne · Slack thread
Summary
Illustrative refactor for an architecture discussion in Slack, demonstrating an alternative pattern for
UsageLogsTable's pagination/refresh state perdocs/guidance/state-and-effects.md(raised as a side discussion on #15151, which already carries its own approval — this is a separate, standalone PR and does not touch that one).Revised after review pushback (Christian): the first version of this PR also replaced
UsageLogsTable'sdefineExpose({ refresh })with arefetchKeyprop threaded down from each parent. That was wrong —refresh()is a stateless imperative command with no state to desync, exactly the case this repo's own convention saysdefineExposeis for (docs/guidance/vue-components.md:21,src/components/AGENTS.md:6,.agents/checks/vue-patterns.md:17).docs/guidance/state-and-effects.mdnever mentionsdefineExpose/imperative commands/child refs at all, so nothing there justified the change. Reverted that part; see "What changed since the last push" below for what's kept instead.Before / After, in plain language
Before
UsageLogsTable.vuekept pagination in one mutable ref,{ page, limit, total, totalPages }, and wrotepagefrom three different places: a page-click handler,refresh()resetting it to1, and the server response echoing it back. Nothing made those three writers agree with each other by construction — they just had to be kept in sync by hand.latestLoadTokencounter guarded against a billing-rail flip superseding an in-flight fetch. That guard is generic pagination-fetch plumbing, but it lived inline in this one component.UsageLogsTablevia a template ref and calling its exposedrefresh()method:CreditsPanel.vue(watchingbalancelocally) andPlanCreditsPanelContent.vue(not watching balance at all — a top-up while on its Activity tab never refreshed that table).After
usePaginatedQuery(src/composables/usePaginatedQuery.ts), owns the query:page,limit,total, andfirstare allcomputedfrom the last server response — one source of truth, not several fields a caller has to remember to keep in sync ("derive everything derivable"). The request-token race guard is baked into the composable once, instead of duplicated per call site.UsageLogsTablestill exposesrefresh()viadefineExpose— unchanged frommain, per review feedback.useBillingContext(the shared composable that already ownsbalance) as a newusageLogsRefreshSignal, instead of each panel re-deriving the same skip-first-hydration balance-watch.CreditsPanelandPlanCreditsPanelContenteach justwatch(usageLogsRefreshSignal, ...)and call their own table ref'srefresh()— the "when" lives once in the data layer; the "how" stays an imperative command on the child, where it belongs. This also fixes thePlanCreditsPanelContentgap above: it now reacts to balance changes too.Why
Per
docs/guidance/state-and-effects.md:computedcan name it, do not put it in arefand keep it in sync by hand — the sync is where the bugs live." (§4) —page/limit/totalarecomputedfrom the response instead of three independently-writable fields.defineExpose/parent-child method calls — that convention comes fromdocs/guidance/vue-components.mdand.agents/checks/vue-patterns.mdinstead, and both call this exact pattern (a stateless command likerefresh()) correct usage.Changes
src/composables/usePaginatedQuery.ts+ test. RefactoredUsageLogsTable.vueto use it instead of a hand-rolled pagination ref andloadTokenguard (still exposesrefresh()). AddedusageLogsRefreshSignaltouseBillingContext/BillingContext(src/composables/billing/types.ts,useBillingContext.ts), owning the balance-change-detection watch once.CreditsPanel.vueandPlanCreditsPanelContent.vuewatch that signal and call their own table ref'srefresh().PlanCreditsPanelContent's Activity tab now refreshes on a genuine balance change, which it never did before (previously onlyCreditsPanelwatched balance at all).Review Focus
usageLogsRefreshSignal(a plain incrementing counter) is the right shape for this signal, versus e.g. a callback-registration/event-bus approach — went with the simpler reactive-counter since it needs no subscribe/unsubscribe lifecycle management.Testing
pnpm test:unit— full suite passes (1201 test files, 16499 tests, 7 expected fail, 13 skipped).pnpm typecheck— clean.pnpm lint— clean (0 errors; pre-existing warnings elsewhere untouched by this PR).