Skip to content

Why would my build files have no content, meta tags, etc? #10900

Closed Answered by robbieaverill
robbieaverill asked this question in Q&A
Discussion options

You must be logged in to vote

After some debugging, I found the issue. We have a HOC in the tree that does this:

export default ({ children }) => {
  const [loaded, setLoaded] = useState(false);

  useEffect(() => {
    setLoaded(true);
  }, []);

  return loaded ? children : null;
}

It makes sense that the contents would be ignored before this HOC has re-rendered.

The solution is ensuring that this component isn't part of the tree when running in the server-only context (<BrowserOnly /> helps with this).

Sorry for wasting your time @slorber, but thank you for the reply.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by robbieaverill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants