-
Notifications
You must be signed in to change notification settings - Fork 281
(feat)O3-4564: Support for single extension slot #1400
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
base: main
Are you sure you want to change the base?
Conversation
|
Size Change: -166 kB (-2.52%) Total Size: 6.4 MB
ℹ️ View Unchanged
|
| } | ||
| } | ||
|
|
||
| extensionInternalStore.subscribe((internalStore) => { |
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.
This pattern of passing in the new store state to the updateExtensionOutputStore should be unnecessary. As a test, I toggled the rde feature flag and confirmed that the patient charts visit notes workspace shows / hides the visit context switcher accordingly.
| state?: Record<string, unknown>; | ||
| } | ||
|
|
||
| export interface OldExtensionSlotBaseProps { |
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.
Identical to ExtensionSlotBaseProps. Removing
| export interface ExtensionSlotBaseProps { | ||
| name: string; | ||
| /** @deprecated Use `name` */ | ||
| extensionSlotName?: string; |
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.
This is several years old. Removing.
| * used to indicate specific configuration. (For example, given a extension with name 'foo', | ||
| * then 'foo', 'foo#bar', 'foo#baz' are all valid extensionIds) | ||
| */ | ||
| export function SingularExtensionSlot({ |
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.
Maybe we could just name this "RenderExtension"? It's not really a "slot" in the normal sense. Barring that, maybe "SingleExtensionSlot" would be better?
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.
Let's go with "SingleExtensionSlot". I'd rather keep 'Slot' as part of the name, as:
- it's still kind of a slot, in line with the analogy that "a slot is a place (to render extensions)".
- It has a slot name, even though it's hard-coded to 'global' for now. I'm not sure if we want to allow the slot name to be something else. (For example, should workspaces be rendered in a slot named 'workspace' instead of 'global'?)
- Confusingly, we already have an external-facing
<Extension>component, which is used inside<ExtensionSlot>but can include other styling surrounding it.
| for (let id of assignedIds) { | ||
| const { config: extensionConfig } = getExtensionConfigFromStore(extensionConfigStoreState, slotName, id); | ||
| for (let id of extensionIds) { | ||
| const { config: extensionConfig } = getExtensionConfigFromStore(extensionStoreState, slotName, id); |
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.
Did you mean to change the store here?
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.
It's a confusing rename. I'll change it.
| type SingularExtensionSlotProps = Omit<ExtensionSlotProps, 'name' | 'select'> & { extensionId: string }; | ||
|
|
||
| /** | ||
| * A special extension slot, with slot name 'global', that renders only one single extension |
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.
It would be nice to include a usage example here as we do with <ExtensionSlot />, especially as this looks like it supports the same feature set.
|
@chibongho Thanks for working on this issue. Could you kindly fix the merge conflicts, please? |
|
hm... I'm not able to reproduce the test failure by doing |
Requirements
feat,fix, orchore, among others). See existing PR titles for inspiration.For changes to apps
If applicable
Summary
This PR introduces a new component
<SingularExtensionSlot>, which allows us to render a specific extension by its name or id.Testing done:
<SingularExtensionSlot>. Also manually used the component and verified that it renders as expected.Screenshots
Related Issue
https://openmrs.atlassian.net/browse/O3-4564
Other
I worked on this because I want to use it as part of the Workspace work. Currently, workspaces are kind of extensions, but they are rendered at the single-spa level. With this work, we should be able to render a particular workspace at the extension level.