Skip to content
Discussion options

You must be logged in to vote

Yes — this is exactly what notifyOnChangeProps is for.

The flash happens because setQueryData notifies every active observer of that query key — including the useQuery on the edit page you're about to leave. notifyOnChangeProps is set per-observer, so you can silence the edit page's observer without affecting the destination page's observer at all. The cache still updates (so the destination renders instantly); the edit page just doesn't re-render.

The clean way is to suppress notifications only during the save → navigate window, using the function form so normal rendering (including the initial pending → success) still works:

const isNavigatingAway = useRef(false);

const { isPending, is…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kimsagro1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants