Description

A dashboard panel shows a timestamp that updates each time the user clicks Refresh.

Anomaly

The panel shows "Last refreshed: Never" on load. Clicking Refresh repeatedly has no effect - the timestamp never updates to the current time.

Constraint
The refreshKey state must change with each click - do not delete it
Hint
Consult the SenseiOnly for those truly stuck · Flip to reveal

React doesn't always re-render when you call setState - when does it decide to skip?

Loading editor…
Correct Solution
Loading...

Why this fixes it

`setRefreshKey(refreshKey)` passed the current value of `refreshKey` back into state - React applies `Object.is` to compare the new value against the old one, and because they were identical primitives, it classified the update as a no-op and bailed out without re-rendering or re-running the effect. Changing the call to `setRefreshKey(prev => prev + 1)` produces a new integer on every click, one that is always different from the previous value. React proceeds with the re-render, the effect fires, and the timestamp updates.

Expected OutputGoal State
Your OutputLive