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(schema-hints): Add interactivity to UI #87227

Merged
merged 2 commits into from
Mar 18, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
show selected tags sorted at the top
nikkikapadia committed Mar 17, 2025
commit c2f2c46a1f45bf55e888d0a5ba07f852a2cb4dc2
28 changes: 21 additions & 7 deletions static/app/views/explore/components/schemaHintsDrawer.tsx
Original file line number Diff line number Diff line change
@@ -29,14 +29,28 @@ function SchemaHintsDrawer({hints}: SchemaHintsDrawerProps) {
return filterQuery.getFilterKeys();
}, [exploreQuery]);

const sortedHints = useMemo(() => {
return hints.toSorted((a, b) => {
// may need to fix this if we don't want to ignore the prefix
const aWithoutPrefix = prettifyTagKey(a.key).replace(/^_/, '');
const bWithoutPrefix = prettifyTagKey(b.key).replace(/^_/, '');
return aWithoutPrefix.localeCompare(bWithoutPrefix);
const sortedSelectedHints = useMemo(() => {
const sortedKeys = selectedFilterKeys.toSorted((a, b) => {
return prettifyTagKey(a).localeCompare(prettifyTagKey(b));
});
}, [hints]);
return sortedKeys
.map(key => hints.find(hint => hint.key === key))
.filter(tag => !!tag);
}, [hints, selectedFilterKeys]);

const sortedHints = useMemo(() => {
return [
...new Set([
...sortedSelectedHints,
...hints.toSorted((a, b) => {
// may need to fix this if we don't want to ignore the prefix
const aWithoutPrefix = prettifyTagKey(a.key).replace(/^_/, '');
const bWithoutPrefix = prettifyTagKey(b.key).replace(/^_/, '');
return aWithoutPrefix.localeCompare(bWithoutPrefix);
}),
]),
];
}, [hints, sortedSelectedHints]);

const handleCheckboxChange = useCallback(
(hint: Tag) => {