pwa-studio icon indicating copy to clipboard operation
pwa-studio copied to clipboard

[bug]: LocaleProvider leads to duplicate query and unnecessary rerender

Open larsroettig opened this issue 3 years ago • 3 comments

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 Screenshot from 2022-02-07 16-59-29

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

larsroettig avatar Feb 07 '22 16:02 larsroettig

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


m2-assistant[bot] avatar Feb 07 '22 16:02 m2-assistant[bot]

@magento export issue to JIRA project PWA as Bug

supernova-at avatar Feb 09 '22 21:02 supernova-at

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/PWA-2576 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Feb 09 '22 21:02 github-jira-sync-bot

The issue is reproducible and hence confirming the issue.

glo80771 avatar Jul 05 '23 13:07 glo80771

@adobe export issue to JIRA project PWA as Bug

glo42707 avatar Jul 06 '23 11:07 glo42707

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/PWA-3165 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Jul 06 '23 12:07 github-jira-sync-bot

Hi @larsroettig ,

As per retesting, the issue is not reproducible by following the below steps:

  1. Installed the package @welldone-software/why-did-you-render
  2. Installed the page craco @craco/craco
  3. Created craco.config.js file
  4. Created wdyr.js and imported it in index.js
  5. Created an empty page
  6. Visited console.log on new page

PFA. Screenshot 2023-08-02 at 1 46 22 PM

Please let us know if we are missing anything.

glo80771 avatar Aug 02 '23 08:08 glo80771

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.

glo80771 avatar Aug 18 '23 10:08 glo80771