Skip to content

Commit

Permalink
fix resize issue (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtassone authored Jul 23, 2020
1 parent b096de0 commit 9451137
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/grid/x-grid-modules/src/hooks/utils/useLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export type LoggerFactoryFn = (name: string) => Logger;
let factory: LoggerFactoryFn | null;
export function useLoggerFactory(
customLogger?: Logger | LoggerFactoryFn,
logLevel: string | boolean = 'info',
logLevel: string | boolean = 'debug',
) {
if (forceDebug) {
factory = defaultFactory('debug');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
ApiRef,
} from '../../models';
import { useLogger } from '../utils/useLogger';
import { COLUMNS_UPDATED } from '../../constants/eventsConstants';
import { COLUMNS_UPDATED, RESIZE } from '../../constants/eventsConstants';
import { useApiMethod } from '../root/useApiMethod';
import { useApiEventHandler } from '../root/useApiEventHandler';

Expand Down Expand Up @@ -147,12 +147,13 @@ export const useVirtualColumns = (
};
useApiMethod(apiRef, virtualApi, 'ColumnVirtualizationApi');

const onColUpdated = useCallback(() => {
const resetRenderedColState = useCallback(() => {
logger.debug('Clearing previous renderedColRef');
renderedColRef.current = null;
}, [logger, renderedColRef]);

useApiEventHandler(apiRef, COLUMNS_UPDATED, onColUpdated);
useApiEventHandler(apiRef, COLUMNS_UPDATED, resetRenderedColState);
useApiEventHandler(apiRef, RESIZE, resetRenderedColState);

return [renderedColRef, updateRenderedCols];
};

0 comments on commit 9451137

Please sign in to comment.