Closed arthurk777 closed 10 months ago
Hi @arthurk777 , Yes this is correct and expected. We watch the configuration and page object for changes in the componentDidUpdate in the BrPage component. This is because one might change the 'path' property for example on route change. We then do a client side API call. This is not configurable at the moment.
In the Next.js example app the template constructs a new configuration object whenever that component rerenders and therefore the componentDidUpdate in the BrPage object will initialize a new request.
If that is not desired you can of course change that template such that you do not construct a new configuration object on every state change / render and if you provide the same page object from the getServerSideProps then you should not see that network request.
If this resolves your question please close the issue :)
Great, thanks for that workaround. We'll send the configuration to BrPage and won't change it after the first load (with useMemo). We use getInitialProps rather than getServerSideProps in our implementation, so our external fetch runs on both server and client. It would be super-awesome to support an optional configuration parameter on BrPage so we can have full control. Thank you for your help!
It would be super-awesome to support an optional configuration parameter on BrPage so we can have full control.
We will keep it in mind!
Hello,
The SDK/BrPage component appears to be making calls, on its own, to the Delivery API internally, even with the "page={page}" parameter being set. Can we have a property to disable this? We handle the HTTP calls to the Delivery API, outside of the BrPage component, both server and client side.
You can observe this behavior by adding the following to "[[...route]].tsx" in one of the Next.js examples:
const [count, setCount] = useState(0);
useEffect(() => {
console.log("*** Observe network calls under Chrome developer toolbar to resourceapi", count);
setTimeout(() => {
setCount(count + 1);
}, 2000);
}, [count, setCount]);