-
Notifications
You must be signed in to change notification settings - Fork 305
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(metadata-sidebar): Fix metadata sidebar ai capabilities #3681
fix(metadata-sidebar): Fix metadata sidebar ai capabilities #3681
Conversation
758dc65
to
45852eb
Compare
onError, | ||
isFeatureEnabled, | ||
}: MetadataSidebarRedesignProps) { | ||
function MetadataSidebarRedesign({ api, elementId, fileId, onError, isFeatureEnabled }: MetadataSidebarRedesignProps) { |
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.
is isFeatureEnabled
doing what useFeatureEnabled
is doing? do we need both?
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.
No I don't think so.
useFeatureEnabled
is checking the features
array. In our case we can check if metadata redesign is enabled, or if metadata aiSuggestions are enabled.
isFeatureEnabled
is a prop that comes from host application in metadataSidebarProps
metadataSidebarProps: MetadataSidebarProps, |
it's defined here
box-ui-elements/src/elements/content-sidebar/MetadataSidebar.js
Lines 43 to 47 in 549188a
type ExternalProps = { | |
isFeatureEnabled: boolean, | |
selectedTemplateKey?: string, | |
templateFilters?: Array<string> | string, | |
}; |
maybe @bfoxx1906 or @jstoffan have more insight if it should be used 🤔
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.
Took a look, useFeatureEnabled isn't used anywhere else in BUIE. However, Seems like a use case for components that don't have the features array passed down, so it probably is needed here. Have we tested useFeatureEnabled works as expected 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.
Yes, useFeatureEnabled
works as expected. It's covered with a storybook story test (also in this PR). It was recommended by @jstoffan some time ago.
Now after re-reading this I understand initial confusion. As I mentioned isFeatereEnalbed
is a prop indicating if user has Metadata Sidebar enabled for them.
src/elements/content-sidebar/stories/tests/MetadataSidebarRedesign-visual.stories.tsx
Outdated
Show resolved
Hide resolved
src/elements/content-sidebar/stories/tests/MetadataSidebarRedesign-visual.stories.tsx
Outdated
Show resolved
Hide resolved
31e646c
to
9c2c031
Compare
src/elements/content-sidebar/stories/tests/MetadataSidebarRedesign-visual.stories.tsx
Outdated
Show resolved
Hide resolved
dcf111c
to
07fe7d4
Compare
src/elements/content-sidebar/stories/tests/MetadataSidebarRedesign-visual.stories.tsx
Outdated
Show resolved
Hide resolved
src/elements/content-sidebar/__tests__/MetadataSidebarRedesign.test.tsx
Outdated
Show resolved
Hide resolved
07fe7d4
to
3c83453
Compare
Co-authored-by: greg-in-a-box <[email protected]>
3c83453
to
471e553
Compare
471e553
to
9dbe6b7
Compare
Fix from where we read if Metadata Sidebar should have AI capabilities turned on.
Screenshots