Openbravo Issue Tracking System - POS2
View Issue Details
0054932POS2Corepublic2024-01-02 13:072024-03-21 18:28
jarmendariz 
cberner 
normalmajorhave not tried
closedfixed 
5
 
23Q4.323Q4.3 
No
0054932: Error page is not shown if the error occurs during registry process
In case the application has a blocking error, an error page defined in ErrorFallback.jsx is shown, but this page shows the company logo using the CompanyLogo component. If this error occurs during the registration process, where the State is not available yet, the Error page won't be shown and the user will encounter a blank screen.
1- Force an error during the registration process. This can be achieved by adding the following in checkIsRegistered() function in Registry.js:

function checkIsRegistered(registry, name, type) {
  if (!_.has(registry, name) || name === 'OBC2_Logout') {
    throw Error(`${type} ${name} is not registered`);
  }
}

2- Open POS2 application in the browser. Instead of rendering the login page or the error page, a blank screen will appear and the following errors in the browser's console:

Uncaught Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>
    at useReduxContext (useReduxContext.js:24:1)
    at useSelector (useSelector.js:125:1)
    at CompanyLogo (CompanyLogo.jsx:31:1)
...
Adding a check in CompanyLogo to show no logo if the state information is not available, preventing the error situation. This way the error page will be shown at least even if it has no logo.
No tags attached.
blocks defect 0054239 closed cberner Error page is not shown if the error occurs during registry process 
Issue History
2024-03-13 10:17AugustoMauchTypedefect => backport
2024-03-13 10:17AugustoMauchTarget Version => 23Q4.3
2024-03-21 18:27hgbotNote Added: 0162517
2024-03-21 18:27hgbotNote Added: 0162518
2024-03-21 18:27hgbotResolutionopen => fixed
2024-03-21 18:27hgbotStatusscheduled => closed
2024-03-21 18:28hgbotFixed in Version => 23Q4.3
2024-03-21 18:28hgbotNote Added: 0162519

Notes
(0162517)
hgbot   
2024-03-21 18:27   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/merge_requests/1428 [^]
(0162518)
hgbot   
2024-03-21 18:27   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/merge_requests/1428 [^]
(0162519)
hgbot   
2024-03-21 18:28   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2 [^]
Changeset: 42980e7a87a87771626562197469f141e69e3d12
Author: Cristian Berner <cristian.berner@openbravo.com>
Date: 21-03-2024 18:27:23
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/commit/42980e7a87a87771626562197469f141e69e3d12 [^]

Fixes ISSUE-54932: Error page is not shown if the error occurs during registry process

The main problem was that CompanyLogo component is used in the
ErrorFallback component, and it makes use of redux state. When errors
happen in the initialization processes(registration of components, and
other initializations), the ErrorFallback component was being rendered
without any provider.

As a fix, even when there are registration errors, CompanyLogo is added
conditionally, if there's no state, it will not be added.

---
M web-jspack/org.openbravo.core2/src/components/ErrorFallback/ErrorFallback.jsx
---