Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) Fix error that appears when changing locale #560

Merged
merged 1 commit into from
Oct 31, 2022

Conversation

denniskigen
Copy link
Member

@denniskigen denniskigen commented Oct 31, 2022

Requirements

  • This PR has a title that briefly describes the work done, including the ticket number if there is a ticket.

For changes to apps

If applicable

  • My work includes tests or is validated by existing tests.
  • I have updated the esm-framework mock to reflect any API changes I have made.

Summary

When a user changes their locale, an error notification appears on the screen. This error seems to be linked to the getSessionLocation function defined in current-user.ts. Specifically, this function seems to try to unsubscribe from an observable whose value is occasionally undefined.

This PR moves the subscription's unsubscribe call outside of the observable definition, ensuring it doesn't get called on an object that might not exist.

Console error

Screenshot 2022-10-31 at 13 10 12

UI error

Screenshot 2022-10-31 at 15 09 30

Presently, when a user changes their locale, a error notification appears on the screen. This error appears to be linked to the `getSessionLocation` function defined in `current-user.ts`. Specifically, it appears that this function tries to unsubscribe from an observable whose value is occasionally `undefined`.

This PR moves the subscription's `unsubscribe` call outside of the observable definition, ensuring it doesn't called on an object that might not exist.
@github-actions
Copy link
Contributor

Size Change: -30 B (0%)

Total Size: 3.43 MB

Filename Size Change
packages/apps/esm-devtools-app/dist/889.js 114 kB -2 B (0%)
packages/apps/esm-implementer-tools-app/dist/889.js 114 kB -3 B (0%)
packages/apps/esm-login-app/dist/889.js 114 kB -3 B (0%)
packages/apps/esm-offline-tools-app/dist/889.js 114 kB -3 B (0%)
packages/apps/esm-primary-navigation-app/dist/889.js 114 kB -2 B (0%)
packages/framework/esm-api/dist/openmrs-esm-api.js 9.44 kB -5 B (0%)
packages/framework/esm-framework/dist/openmrs-esm-framework.js 211 kB -4 B (0%)
packages/shell/esm-app-shell/dist/esm-devtools-app/889.js 114 kB -2 B (0%)
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/889.js 114 kB -3 B (0%)
packages/shell/esm-app-shell/dist/esm-login-app/889.js 114 kB -3 B (0%)
packages/shell/esm-app-shell/dist/esm-offline-tools-app/889.js 114 kB -3 B (0%)
packages/shell/esm-app-shell/dist/esm-primary-navigation-app/889.js 114 kB -2 B (0%)
packages/shell/esm-app-shell/dist/openmrs.js 365 kB -5 B (0%)
packages/shell/esm-app-shell/dist/service-worker.js 61.8 kB +10 B (0%)
ℹ️ View Unchanged
Filename Size
packages/apps/esm-devtools-app/dist/733.js 3.55 kB
packages/apps/esm-devtools-app/dist/735.js 2.63 kB
packages/apps/esm-devtools-app/dist/988.js 363 B
packages/apps/esm-devtools-app/dist/main.js 2.87 kB
packages/apps/esm-devtools-app/dist/openmrs-esm-devtools-app.js 3.04 kB
packages/apps/esm-implementer-tools-app/dist/102.js 2.76 kB
packages/apps/esm-implementer-tools-app/dist/146.js 6.71 kB
packages/apps/esm-implementer-tools-app/dist/190.js 61.1 kB
packages/apps/esm-implementer-tools-app/dist/246.js 1.13 kB
packages/apps/esm-implementer-tools-app/dist/280.js 3.46 kB
packages/apps/esm-implementer-tools-app/dist/284.js 1.46 kB
packages/apps/esm-implementer-tools-app/dist/319.js 454 B
packages/apps/esm-implementer-tools-app/dist/406.js 11.6 kB
packages/apps/esm-implementer-tools-app/dist/519.js 2.36 kB
packages/apps/esm-implementer-tools-app/dist/531.js 1.49 kB
packages/apps/esm-implementer-tools-app/dist/542.js 2.04 kB
packages/apps/esm-implementer-tools-app/dist/574.js 428 B
packages/apps/esm-implementer-tools-app/dist/620.js 126 kB
packages/apps/esm-implementer-tools-app/dist/626.js 5.06 kB
packages/apps/esm-implementer-tools-app/dist/735.js 2.63 kB
packages/apps/esm-implementer-tools-app/dist/769.js 11.8 kB
packages/apps/esm-implementer-tools-app/dist/788.js 42.9 kB
packages/apps/esm-implementer-tools-app/dist/main.js 3.94 kB
packages/apps/esm-implementer-tools-app/dist/openmrs-esm-implementer-tools-app.js 3.26 kB
packages/apps/esm-login-app/dist/236.js 268 B
packages/apps/esm-login-app/dist/240.js 359 B
packages/apps/esm-login-app/dist/272.js 260 B
packages/apps/esm-login-app/dist/319.js 356 B
packages/apps/esm-login-app/dist/336.js 224 B
packages/apps/esm-login-app/dist/390.js 597 B
packages/apps/esm-login-app/dist/406.js 1.13 kB
packages/apps/esm-login-app/dist/420.js 1.61 kB
packages/apps/esm-login-app/dist/50.js 6.18 kB
packages/apps/esm-login-app/dist/539.js 294 B
packages/apps/esm-login-app/dist/574.js 443 B
packages/apps/esm-login-app/dist/581.js 23.9 kB
packages/apps/esm-login-app/dist/607.js 3.92 kB
packages/apps/esm-login-app/dist/611.js 720 B
packages/apps/esm-login-app/dist/644.js 299 B
packages/apps/esm-login-app/dist/673.js 278 B
packages/apps/esm-login-app/dist/735.js 2.63 kB
packages/apps/esm-login-app/dist/757.js 293 B
packages/apps/esm-login-app/dist/759.js 16.5 kB
packages/apps/esm-login-app/dist/788.js 42.9 kB
packages/apps/esm-login-app/dist/897.js 5.14 kB
packages/apps/esm-login-app/dist/925.js 6.66 kB
packages/apps/esm-login-app/dist/951.js 1.31 kB
packages/apps/esm-login-app/dist/main.js 3.29 kB
packages/apps/esm-login-app/dist/openmrs-esm-login-app.js 3.18 kB
packages/apps/esm-offline-tools-app/dist/126.js 1.35 kB
packages/apps/esm-offline-tools-app/dist/259.js 2.77 kB
packages/apps/esm-offline-tools-app/dist/290.js 434 B
packages/apps/esm-offline-tools-app/dist/316.js 3.56 kB
packages/apps/esm-offline-tools-app/dist/373.js 2.83 kB
packages/apps/esm-offline-tools-app/dist/391.js 299 B
packages/apps/esm-offline-tools-app/dist/412.js 3.84 kB
packages/apps/esm-offline-tools-app/dist/456.js 1.89 kB
packages/apps/esm-offline-tools-app/dist/466.js 51.1 kB
packages/apps/esm-offline-tools-app/dist/518.js 2.1 kB
packages/apps/esm-offline-tools-app/dist/541.js 379 B
packages/apps/esm-offline-tools-app/dist/574.js 993 B
packages/apps/esm-offline-tools-app/dist/58.js 1.99 kB
packages/apps/esm-offline-tools-app/dist/675.js 4.31 kB
packages/apps/esm-offline-tools-app/dist/733.js 285 B
packages/apps/esm-offline-tools-app/dist/735.js 2.63 kB
packages/apps/esm-offline-tools-app/dist/759.js 16.5 kB
packages/apps/esm-offline-tools-app/dist/788.js 42.9 kB
packages/apps/esm-offline-tools-app/dist/795.js 5.55 kB
packages/apps/esm-offline-tools-app/dist/845.js 7.43 kB
packages/apps/esm-offline-tools-app/dist/925.js 6.66 kB
packages/apps/esm-offline-tools-app/dist/967.js 489 B
packages/apps/esm-offline-tools-app/dist/996.js 5.88 kB
packages/apps/esm-offline-tools-app/dist/main.js 52.2 kB
packages/apps/esm-offline-tools-app/dist/openmrs-esm-offline-tools-app.js 3.27 kB
packages/apps/esm-primary-navigation-app/dist/146.js 6.72 kB
packages/apps/esm-primary-navigation-app/dist/216.js 544 B
packages/apps/esm-primary-navigation-app/dist/414.js 461 B
packages/apps/esm-primary-navigation-app/dist/473.js 1.16 kB
packages/apps/esm-primary-navigation-app/dist/483.js 11.4 kB
packages/apps/esm-primary-navigation-app/dist/574.js 178 B
packages/apps/esm-primary-navigation-app/dist/656.js 5.49 kB
packages/apps/esm-primary-navigation-app/dist/723.js 4.52 kB
packages/apps/esm-primary-navigation-app/dist/735.js 2.63 kB
packages/apps/esm-primary-navigation-app/dist/787.js 9.38 kB
packages/apps/esm-primary-navigation-app/dist/788.js 42.9 kB
packages/apps/esm-primary-navigation-app/dist/789.js 8.89 kB
packages/apps/esm-primary-navigation-app/dist/98.js 2.18 kB
packages/apps/esm-primary-navigation-app/dist/main.js 9.39 kB
packages/apps/esm-primary-navigation-app/dist/openmrs-esm-primary-navigation-app.js 3.27 kB
packages/framework/esm-breadcrumbs/dist/openmrs-esm-breadcrumbs.js 3.24 kB
packages/framework/esm-config/dist/openmrs-esm-module-config.js 7.97 kB
packages/framework/esm-error-handling/dist/openmrs-esm-error-handling.js 1.41 kB
packages/framework/esm-extensions/dist/openmrs-esm-extensions.js 8.45 kB
packages/framework/esm-globals/dist/openmrs-esm-globals.js 1.59 kB
packages/framework/esm-offline/dist/openmrs-esm-offline.js 35 kB
packages/framework/esm-react-utils/dist/openmrs-esm-react-utils.js 22.5 kB
packages/framework/esm-state/dist/openmrs-esm-state.js 1.47 kB
packages/framework/esm-styleguide/dist/openmrs-esm-styleguide.js 19.1 kB
packages/framework/esm-utils/dist/openmrs-esm-utils.js 10.8 kB
packages/shell/esm-app-shell/dist/9e581025e7b63e20aadf.js 1.59 kB
packages/shell/esm-app-shell/dist/esm-devtools-app/733.js 3.55 kB
packages/shell/esm-app-shell/dist/esm-devtools-app/735.js 2.63 kB
packages/shell/esm-app-shell/dist/esm-devtools-app/988.js 363 B
packages/shell/esm-app-shell/dist/esm-devtools-app/main.js 2.87 kB
packages/shell/esm-app-shell/dist/esm-devtools-app/openmrs-esm-devtools-app.js 3.02 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/102.js 2.76 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/146.js 6.71 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/190.js 61.1 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/246.js 1.13 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/280.js 3.45 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/284.js 1.46 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/319.js 454 B
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/406.js 11.5 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/519.js 2.36 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/531.js 1.49 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/542.js 2.04 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/574.js 428 B
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/620.js 126 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/626.js 4.97 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/735.js 2.63 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/769.js 11.7 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/788.js 42.9 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/main.js 3.94 kB
packages/shell/esm-app-shell/dist/esm-implementer-tools-app/openmrs-esm-implementer-tools-app.js 3.25 kB
packages/shell/esm-app-shell/dist/esm-login-app/236.js 268 B
packages/shell/esm-app-shell/dist/esm-login-app/240.js 359 B
packages/shell/esm-app-shell/dist/esm-login-app/272.js 260 B
packages/shell/esm-app-shell/dist/esm-login-app/319.js 356 B
packages/shell/esm-app-shell/dist/esm-login-app/336.js 224 B
packages/shell/esm-app-shell/dist/esm-login-app/390.js 597 B
packages/shell/esm-app-shell/dist/esm-login-app/406.js 1.13 kB
packages/shell/esm-app-shell/dist/esm-login-app/420.js 1.61 kB
packages/shell/esm-app-shell/dist/esm-login-app/50.js 6.15 kB
packages/shell/esm-app-shell/dist/esm-login-app/539.js 294 B
packages/shell/esm-app-shell/dist/esm-login-app/574.js 443 B
packages/shell/esm-app-shell/dist/esm-login-app/581.js 24 kB
packages/shell/esm-app-shell/dist/esm-login-app/607.js 3.92 kB
packages/shell/esm-app-shell/dist/esm-login-app/611.js 720 B
packages/shell/esm-app-shell/dist/esm-login-app/644.js 299 B
packages/shell/esm-app-shell/dist/esm-login-app/673.js 278 B
packages/shell/esm-app-shell/dist/esm-login-app/735.js 2.63 kB
packages/shell/esm-app-shell/dist/esm-login-app/757.js 293 B
packages/shell/esm-app-shell/dist/esm-login-app/759.js 16.5 kB
packages/shell/esm-app-shell/dist/esm-login-app/788.js 42.9 kB
packages/shell/esm-app-shell/dist/esm-login-app/897.js 5.14 kB
packages/shell/esm-app-shell/dist/esm-login-app/925.js 6.65 kB
packages/shell/esm-app-shell/dist/esm-login-app/951.js 1.31 kB
packages/shell/esm-app-shell/dist/esm-login-app/main.js 3.29 kB
packages/shell/esm-app-shell/dist/esm-login-app/openmrs-esm-login-app.js 3.16 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/126.js 1.35 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/259.js 2.74 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/290.js 434 B
packages/shell/esm-app-shell/dist/esm-offline-tools-app/316.js 3.56 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/373.js 2.73 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/391.js 299 B
packages/shell/esm-app-shell/dist/esm-offline-tools-app/412.js 3.79 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/456.js 1.88 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/466.js 51.2 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/518.js 2.1 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/541.js 379 B
packages/shell/esm-app-shell/dist/esm-offline-tools-app/574.js 993 B
packages/shell/esm-app-shell/dist/esm-offline-tools-app/58.js 1.99 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/675.js 4.29 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/733.js 285 B
packages/shell/esm-app-shell/dist/esm-offline-tools-app/735.js 2.63 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/759.js 16.5 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/788.js 42.9 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/795.js 5.55 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/845.js 7.41 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/925.js 6.66 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/967.js 489 B
packages/shell/esm-app-shell/dist/esm-offline-tools-app/996.js 5.8 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/main.js 52.2 kB
packages/shell/esm-app-shell/dist/esm-offline-tools-app/openmrs-esm-offline-tools-app.js 3.25 kB
packages/shell/esm-app-shell/dist/esm-primary-navigation-app/146.js 6.71 kB
packages/shell/esm-app-shell/dist/esm-primary-navigation-app/216.js 544 B
packages/shell/esm-app-shell/dist/esm-primary-navigation-app/414.js 461 B
packages/shell/esm-app-shell/dist/esm-primary-navigation-app/473.js 1.16 kB
packages/shell/esm-app-shell/dist/esm-primary-navigation-app/483.js 11.4 kB
packages/shell/esm-app-shell/dist/esm-primary-navigation-app/574.js 178 B
packages/shell/esm-app-shell/dist/esm-primary-navigation-app/656.js 5.48 kB
packages/shell/esm-app-shell/dist/esm-primary-navigation-app/723.js 4.49 kB
packages/shell/esm-app-shell/dist/esm-primary-navigation-app/735.js 2.63 kB
packages/shell/esm-app-shell/dist/esm-primary-navigation-app/787.js 9.38 kB
packages/shell/esm-app-shell/dist/esm-primary-navigation-app/788.js 42.9 kB
packages/shell/esm-app-shell/dist/esm-primary-navigation-app/789.js 8.89 kB
packages/shell/esm-app-shell/dist/esm-primary-navigation-app/98.js 2.17 kB
packages/shell/esm-app-shell/dist/esm-primary-navigation-app/main.js 9.39 kB
packages/shell/esm-app-shell/dist/esm-primary-navigation-app/openmrs-esm-primary-navigation-app.js 3.25 kB
packages/tooling/openmrs/dist/cli.js 2.99 kB
packages/tooling/openmrs/dist/commands/assemble.js 2.22 kB
packages/tooling/openmrs/dist/commands/build.js 2.26 kB
packages/tooling/openmrs/dist/commands/debug.js 539 B
packages/tooling/openmrs/dist/commands/develop.js 1.66 kB
packages/tooling/openmrs/dist/commands/index.js 360 B
packages/tooling/openmrs/dist/commands/start.js 848 B
packages/tooling/openmrs/dist/index.js 445 B
packages/tooling/openmrs/dist/runner.js 799 B
packages/tooling/openmrs/dist/utils/config.js 639 B
packages/tooling/openmrs/dist/utils/debugger.js 529 B
packages/tooling/openmrs/dist/utils/dependencies.js 300 B
packages/tooling/openmrs/dist/utils/helpers.js 275 B
packages/tooling/openmrs/dist/utils/importmap.js 2.79 kB
packages/tooling/openmrs/dist/utils/index.js 370 B
packages/tooling/openmrs/dist/utils/logger.js 234 B
packages/tooling/openmrs/dist/utils/untar.js 648 B
packages/tooling/openmrs/dist/utils/variables.js 192 B
packages/tooling/openmrs/dist/utils/webpack.js 276 B
packages/tooling/webpack-config/dist/index.js 3.01 kB
packages/tooling/webpack-config/dist/optimize.js 1.79 kB

compressed-size-action

@denniskigen denniskigen merged commit 304fd2e into main Oct 31, 2022
@denniskigen denniskigen deleted the fix/locale-change-error branch October 31, 2022 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants