-
Notifications
You must be signed in to change notification settings - Fork 208
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
(BREAKING) Retire concept of ConnectedExtension #1154
Conversation
Size Change: +189 kB (+3.18%) Total Size: 6.11 MB
ℹ️ View Unchanged
|
@@ -1,5 +1,5 @@ | |||
import React from 'react'; | |||
import { act, render, screen, waitFor } from '@testing-library/react'; | |||
import { act, render, prettyDOM, screen, waitFor } from '@testing-library/react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { act, render, prettyDOM, screen, waitFor } from '@testing-library/react'; | |
import { act, render, screen, waitFor } from '@testing-library/react'; |
Unused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was using it for troubleshooting and forgot to remove it.
if (openWorkspace.title == getWorkspaceTitle(openWorkspace, openWorkspace.additionalProps)) { | ||
openWorkspace.title = getWorkspaceTitle(openWorkspace, newWorkspace.additionalProps); | ||
if (openWorkspace.title === getWorkspaceTitle(openWorkspace, openWorkspace.additionalProps)) { | ||
openWorkspace.title = getWorkspaceTitle(newWorkspace, newWorkspace.additionalProps); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent change, thank you @ibacher . A couple suggestions but generally LGTM.
4651685
to
097b0f6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks, @ibacher.
…ponent This fix addresses a potential runtime error in the VisitSummary component when a visit has no extensions. The error occurs due to recent changes in the [useConnectedExtensions](openmrs/openmrs-esm-core#1154) hook, which possibly now loads extensions asynchronously. The [current implementation](https://github.com/openmrs/openmrs-esm-patient-chart/blob/3b13b5b5d7ce39dbe54508a2041ececb28f2d33e/packages/esm-patient-chart-app/src/visit/visits-widget/past-visits-components/visit-summary.component.tsx#L157) assumes extensions are always available when rendering. If extensions are not yet loaded when the component renders, it throws an error. I've remedied this by adding optional chaining to the extensions mapping. This ensures the component gracefully handles cases where extensions are undefined or not yet loaded.
Requirements
feat
,fix
, orchore
, among others). See existing PR titles for inspiration.For changes to apps
If applicable
Summary
esm-core tracks extensions in various forms (there are others; these are the relevant ones here):
ExtensionDefinition
: An extension as defined in an appsroutes.json
ExtensionRegistration
: An extension registered with the extension systemAssignedExtension
: An extension instance, representing an extension in a specific slotConnectedExtension
: An "assigned" extension that is also available due to either the presence of a feature flag or the browsers online status and the extensions definition.This PR collapses the distinction between
AssignedExtension
andConnectedExtension
, that is, an extension is only assigned to a slot now if:This is accomplished by making the "output extension store" dependent on the featureFlag store, the browser's online status, and the current session store. These dependencies are now centralized as part of the internal
getAssignedExtensionsFromSlotData()
and the relevant public APIs have been updated to supply the necessary data.Prior to this change, assigned extensions were not recalculated globally, but instead, each instance of an
ExtensionSlot
would calluseConnectedExtensions()
, which would load the current feature flags and online status and use these to filter theAssignedExtensions
.There are two reasons for this change:
useConnectedExtensions()
instance.This PR removes all of the
ConnectedExtension
internals, however, theuseConnectedExtensions()
hook (now an alias foruseAssignedExtensions()
) remains so as to not break too much code.I've also taken this opportunity to completely remove the support for the
wrap
property from the ReactExtension
object.Screenshots
Related Issue
Other