Skip to content
Discussion options

You must be logged in to vote

I'm silly. The problem was not with useFetcher at all.

The full code was:

  const [urlText, setUrlText] = useState("");
  const url = useMemo(() => getURL(prefixWithHttps(urlText)), [urlText]);
  const [debouncedUrl] = useDebounce(url, 250);

  const fetcher = useFetcher<PreviewResponse>();

  useEffect(() => {
    if (url === null || !fetcher) return;
    fetcher.load(`/api/preview?url=${encodeURIComponent(url.toString())}`);
  }, [debouncedUrl]);

Originally, I had const debouncedUrl = useDebouced(url, 250); -- which was bad because the useDebounce hook returns an array.

However, I also swear my minimal reproduction was broken at one point. I think there was some version of the minimal …

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@sergiodxa
Comment options

@vedantroy
Comment options

Answer selected by vedantroy
Comment options

You must be logged in to vote
2 replies
@kiliman
Comment options

@estenp
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants