Bug report
Description / Observed Behavior
Code keeps getting called repeatedly eventually ending in a Maximum update depth error.
Expected Behavior
Call should work as expected. I'm just trying to make a basic axios post request.
Repro Steps / Code Example
// App.tsx
import React from 'react';
import https from "https";
import axios from "axios";
import useSWR from "swr";
type myInput = {
myInputData: string;
};
export function App() {
const { data, error } = useSWR(
[
"/api/myEndpoint",
{
myInputData: "12345",
},
],
myFetcher
);
console.log("SWR response:", data);
return <></>
}
const myFetcher = async (url: string, input: myInput) => {
const agent = new https.Agent({
// custom agent config
});
const response = await axios({
method: "post",
url: url,
data: input,
httpsAgent: agent,
});
return response.data;
};
Additional Context
SWR version: 0.2.3