It's strange that this error happens when you do full reload π€.
I believe the problem you are having is due to partial page navigation. This is when SharePoint refreshes just part of the page not the whole website and it means many parts like oninit on useEffect on first run will not rerun and due to that the sp.web may still be relying on an outdated or uninitialized context.
This may happen when you initialize sp.setup({...})
only once, say in onInit
, and itβs not updated on subsequent navigations.
You may find more context in this article.
https://www.blimped.nl/spfx-and-the-potential-pitfall-of-partial-page-navigation/
Hope what I suspect is correct and my comment will help you get unblocked π€π€
Happy Coding!