You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When SPA (Liferay + Senna.js) is enabled JavaScript code will get rendered twice. With regards to React this means the component and any code inside useEffect(() => {}, []); will be executed twice. With regards to fetch calls this is (somewhat) problematic.
A possible solution provided by the following Liferay article is to use Liferay.on('SPAReady', () => {}); which would prevent the code from being executed twice.
I am wondering if the Liferay Frontend Infrastructure has any other possible solution that would prevent a React component from being rendered twice? Maybe the solution provided by the Liferay article is the way to go but I would appreciate if somebody with more Liferay frontend knowledge could confirm that.
The text was updated successfully, but these errors were encountered:
When SPA (Liferay + Senna.js) is enabled JavaScript code will get rendered twice. With regards to React this means the component and any code inside
useEffect(() => {}, []);
will be executed twice. With regards to fetch calls this is (somewhat) problematic.A possible solution provided by the following Liferay article is to use
Liferay.on('SPAReady', () => {});
which would prevent the code from being executed twice.I am wondering if the Liferay Frontend Infrastructure has any other possible solution that would prevent a React component from being rendered twice? Maybe the solution provided by the Liferay article is the way to go but I would appreciate if somebody with more Liferay frontend knowledge could confirm that.
The text was updated successfully, but these errors were encountered: