Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preload is invalid when use array key, Does it only work in string key ? #3020

Open
vaynevayne opened this issue Sep 11, 2024 · 1 comment
Open

Comments

@vaynevayne
Copy link

 const { data } = useSWR([url,key], ([url,params]) =>
    axios.get(url,{params}),
  )

 preload(
               [url,key],
                ([url,params]) => axios.get(url,{params}),
              )
@3pleFly
Copy link

3pleFly commented Oct 10, 2024

Having this issue myself...
I ended up just removing the key array unforunately,

export const usePayslips = (year: number | null) =>
useSWRImmutable<IPayslip[]>(
year ? ${PrivateEndpoints.PAYSLIP}?year=${year} : null,
{
fetcher: (url) =>
privateApi.get<IPayslip[]>(url).then((r) => r.data ?? []),
suspense: true,
}
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants