platforms icon indicating copy to clipboard operation
platforms copied to clipboard

Post view page generates infinite network requests

Open itaykat opened this issue 8 months ago • 2 comments

When entering a specific post, the page generates non stop POST requests to thttps://app.domain.com/post/<page_id>

itaykat avatar Dec 02 '23 19:12 itaykat

I solved it by adding an empty array as a dependency in the useeffect in the nav.tsx component. I'm not sure it's the right thing to do, but it works. Screenshot 2024-01-05 at 7 46 19 p m

jocadevone avatar Jan 06 '24 01:01 jocadevone

I had the same problem, but when I remove the dependency array then the navigation will not work correctly and the "Back to all posts" menu will take back to the all sites page. My solution for the issue to add the siteId to the dependency list in the nav.tsx, so finally it looks like this.

useEffect(() => {
    if (segments[0] === "post" && id && !siteId) {
      getSiteFromPostId(id).then((id) => {
        setSiteId(id);
      });
    }
  }, [segments, id, siteId]);

JoeCam88 avatar Jan 23 '24 14:01 JoeCam88