pwa-studio
pwa-studio copied to clipboard
[bug]: LocaleProvider leads to duplicate query and unnecessary rerender
Describe the bug
To reproduce
- Add https://github.com/welldone-software/why-did-you-render
- Create an Empty Page
- Visit console.log on the new Page
- you get the following messages
Expected behaviour
- No Error appears
Screenshots
Possible solutions
Change:
https://github.com/magento/pwa-studio/blob/03535e58c76c1caad8184cfef1f0f42acd0bf87e/packages/venia-ui/lib/components/App/localeProvider.js#L55-L64
To:
const handleIntlError = useCallback(error => {
if (messages) {
if (error.code === 'MISSING_TRANSLATION') {
console.warn('Missing translation', error.message);
return;
}
throw error;
}
},[messages]);
Debug Report
Paste the output of yarn build:report
, and any other context about the problem, here.
Please complete the following device information:
- Device [e.g. iPhone6, PC, Mac, Pixel3]:
- Browser [e.g. Chrome, Safari]:
- Browser Version [e.g. 22]:
- Magento Version [e.g Magento Commerce 2.4]:
Please let us know what packages this bug is in regards to:
- [ ]
venia-concept
- [ ]
venia-ui
- [ ]
pwa-buildpack
- [ ]
peregrine
- [ ]
pwa-devdocs
- [ ]
upward-js
- [ ]
upward-spec
- [ ]
create-pwa
Hi @larsroettig. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this
- Join Magento Community Engineering Slack and ask your questions in #github channel.
@magento export issue to JIRA project PWA as Bug
:white_check_mark: Jira issue https://jira.corp.magento.com/browse/PWA-2576 is successfully created for this GitHub issue.
The issue is reproducible and hence confirming the issue.
@adobe export issue to JIRA project PWA as Bug
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/PWA-3165 is successfully created for this GitHub issue.
Hi @larsroettig ,
As per retesting, the issue is not reproducible by following the below steps:
- Installed the package @welldone-software/why-did-you-render
- Installed the page craco @craco/craco
- Created craco.config.js file
- Created wdyr.js and imported it in index.js
- Created an empty page
- Visited console.log on new page
PFA.
Please let us know if we are missing anything.
Closing the ticket since no response for more than two weeks. Please feel free to reopen the ticket in case the issue is still there.