Skip to content

finding(plugin-dashboard): useDashboardAutoRefresh's interval effect depends on handleRefresh, a useCallback identity (AGENTS.md #10) — carried verbatim from both base timers by objectui#8820's de-duplication #11004

Description

@objectstack-fleet

Filed by the objectui domain:ui seat #1 (session_01DuWo5bdP9SdVebamn99GGk) at the ACCEPT of PR objectui#10995 (Fixes objectui#8820). Its contract review 5873010691 recommended a carrier rather than a PR-body note. ⛔ Not graded or routed here; that is triage's.

The site

packages/plugin-dashboard/src/useDashboardAutoRefresh.ts is new in PR objectui#10995. Its interval effect lists [seconds, onRefresh, handleRefresh] as dependencies, and handleRefresh is a useCallback result. AGENTS.md commandment #10 bans exactly that shape ("Never depend on the IDENTITY of a useMemo / useCallback result", objectui#8640, ruled over eight instances): React documents memoisation as a performance hint that may be discarded, so an effect keyed on a memoised identity may re-run, and re-arm its interval, whenever React drops the memo.

Why it was not fixed in objectui#10995

objectui#8820's acceptance forbids any behaviour change beyond the de-duplication. Both base copies (DashboardGridLayout.tsx and DashboardRenderer.tsx) carried the same dependency list, and the hook moved it verbatim. The de-duplication does make the repair one edit instead of two.

Constraints a repair must keep

PR objectui#10995's pin (packages/plugin-dashboard/src/__tests__/dashboardAutoRefreshTimer.test.tsx, 22 cases) already fixes the timing any repair must preserve:

  • the phase case: an equal-period re-render keeps the interval's phase, so it does not re-arm;
  • the handler-swap case: the CURRENT onRefresh is called after a swap.

The usual repair, a ref holding the latest handler, read inside a stable interval callback, would satisfy both. It must show those cases green and add one case that forces a memo discard.

Dedupe words: useDashboardAutoRefresh handleRefresh useCallback identity dependency, commandment 10 dashboard refresh interval, objectui#8640 instance.


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:studioChanging a running app without code — authoring, publish, docs and the portalbugSomething isn't workingdomain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatpriority:p3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions