Merge pull request #791 from benphelps/fix-787

Fix: useWidgetAPI refreshInterval not working
pull/793/head
shamoon 2 years ago committed by GitHub
commit cf38395100
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,8 +4,8 @@ import { formatProxyUrl } from "./api-helpers";
export default function useWidgetAPI(widget, ...options) {
const config = {};
if (options?.refreshInterval) {
config.refreshInterval = options.refreshInterval;
if (options && options[1]?.refreshInterval) {
config.refreshInterval = options[1].refreshInterval;
}
const { data, error } = useSWR(formatProxyUrl(widget, ...options), config);
// make the data error the top-level error

Loading…
Cancel
Save