Skip to content

Commit

Permalink
always show columns in inspector and table
Browse files Browse the repository at this point in the history
  • Loading branch information
neindochoh committed Oct 9, 2023
1 parent 8eb4e90 commit ad015e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/widgets/DataGrid/DataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ const DataGrid: Widget = () => {

const [scrollbarWidth] = getScrollbarSize();

const defaultVisibleColumnKeys = useMemo(
() =>
allColumns
.filter((column) => columnVisibleByDefault(column))
.map(({ key }) => key),
[allColumns]
);
const defaultVisibleColumnKeys = useMemo(() => {
const visibleColumnKeys = allColumns
.filter((column) => columnVisibleByDefault(column))
.map(({ key }) => key);
if (visibleColumnKeys.length) return visibleColumnKeys;
return allColumns.filter((col) => !col.hidden).map(({ key }) => key);
}, [allColumns]);

const [tableView, setTableView] = useWidgetConfig<TableView>('tableView', 'full');
const [visibleColumns, setVisibleColumns] = useWidgetConfig<string[]>(
Expand Down
6 changes: 5 additions & 1 deletion src/widgets/Inspector/store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ const StoreProvider = ({ children }: ProviderProps): JSX.Element => {
const allColumns = useDataset((d) => d.columns);
const lenses = useComponentsStore((d) => d.lensesByKey);
const defaultLenses = useMemo(() => {
const defaultColumns = allColumns.filter((c) => c.type.binary && !c.hidden);
const visibleColumns = allColumns.filter(
(c) => !c.hidden && c.type.kind !== 'Embedding'
);
const binaryColumns = visibleColumns.filter((c) => c.type.binary);
const defaultColumns = binaryColumns.length ? binaryColumns : visibleColumns;
return _.compact(
defaultColumns.map((column) => {
const lens = Object.values(lenses).filter((lens) =>
Expand Down

0 comments on commit ad015e3

Please sign in to comment.