RevereCRE/relay-nextjs

Page component got mount again when using array in query variables

vip30 opened this issue · 2 comments

vip30 commented

latch.current = !Object.keys(queryVariables as {}).every(
(key) =>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(queryVariables as any)[key] === (initialQueryVars.current as any)[key]
);

Seems it's because relay-nextjs is using shallow comparison so if we're using array in the qurey variables, the useHaveQueryVariablesChanges will return true by each of the re-render

Is that possible to use deep compare?

Thank you for bringing this up! This should be fix with the 2.0 release later today or tomorrow as we now use a deep-equal comparison. Will update here upon release!

v2.0.0 has been released! This should no longer be an issue.