-
Notifications
You must be signed in to change notification settings - Fork 2
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
Contextual data for auto cluster and summarization #2959
Conversation
app/components/TagInput/index.tsx
Outdated
const handleTagRemove = useCallback(() => { | ||
onRemove(label); | ||
}, [onRemove, label]); |
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.
use label as tag name and put onRemove in onClick of Button
@@ -147,6 +158,7 @@ export interface AnalyticalStatementInputProps { | |||
listeners?: Listeners; | |||
onSelectedNgramChange: (item: string | undefined) => void; | |||
framework: Framework; | |||
frameworkTagLabels: { [x: string]: 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.
frameworkTagLabels: { [x: string]: string }; | |
frameworkTagLabels: Record<string, string>; |
if (attribute.widgetType === 'MATRIX1D') { | ||
const pillars = attribute.data?.value; | ||
const test = Object.keys(pillars ?? []) | ||
?.map((pillarKey) => Object.keys(pillars?.[pillarKey] ?? [])) |
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.
?.map((pillarKey) => Object.keys(pillars?.[pillarKey] ?? [])) | |
?.map((pillarKey) => Object.keys(pillars?.[pillarKey] ?? {})) |
} | ||
if (attribute.widgetType === 'MATRIX1D') { | ||
const pillars = attribute.data?.value; | ||
const test = Object.keys(pillars ?? []) |
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.
const test = Object.keys(pillars ?? []) | |
const pillarKeys = Object.keys(pillars ?? []) |
app/views/PillarAnalysis/index.tsx
Outdated
const selectedFilters = useMemo(() => ( | ||
listToMap( | ||
sourcesFilterValue?.entriesFilterData?.filterableData, | ||
(d) => d.filterKey, | ||
(d) => d.valueList, | ||
) | ||
), [sourcesFilterValue?.entriesFilterData?.filterableData]); | ||
|
||
const selectedFilterKeys = useMemo(() => ( | ||
Object.keys(selectedFilters ?? {}) | ||
), [ | ||
selectedFilters, | ||
]); | ||
|
||
const widgetTagMap = useMemo(() => (frameworkFilters | ||
?.map((widget) => { | ||
if ( | ||
widget.widgetType === 'SELECT' | ||
|| widget.widgetType === 'MULTISELECT' | ||
|| widget.widgetType === 'ORGANIGRAM' | ||
|| widget.widgetType === 'MATRIX1D' | ||
|| widget.widgetType === 'MATRIX2D' | ||
) { | ||
return widget; | ||
} | ||
return undefined; | ||
}).filter(isDefined).filter( | ||
(ff) => selectedFilterKeys.includes(ff.key), | ||
)?.map((ff) => ({ | ||
key: ff.key, | ||
options: ff.properties?.options, | ||
})) | ||
), [ | ||
frameworkFilters, | ||
selectedFilterKeys, | ||
]); | ||
|
||
const widgetTagLabels = useMemo(() => ( | ||
widgetTagMap?.flatMap( | ||
(option) => option?.options?.filter( | ||
(widget) => selectedFilters?.[option.key]?.includes(widget.key), | ||
)?.map( | ||
(item: {key: string, label: string}) => item?.label, | ||
), | ||
).filter(isDefined) | ||
), [ | ||
selectedFilters, | ||
widgetTagMap, | ||
]); |
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.
do it inside a single useMemo
app/views/PillarAnalysis/index.tsx
Outdated
); | ||
|
||
const widgetTagsFromPrimaryTagging: { | ||
[x: string]: 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.
[x: string]: string | |
Record<string, string> |
app/views/PillarAnalysis/index.tsx
Outdated
@@ -1148,15 +1157,142 @@ function PillarAnalysis() { | |||
})); | |||
}, [setSourcesFilterValue]); | |||
|
|||
const entriesForStatements = listToMap( |
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.
Add useMemo for all functions in this page
1068368
to
86d2c9e
Compare
86d2c9e
to
0705da8
Compare
7a4291b
to
e9a9c18
Compare
e9a9c18
to
a3af782
Compare
Changes
This PR doesn't introduce any:
console.log
meant for debugging