mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
Fixed undo redo breaking on setting component properties
This commit is contained in:
parent
65b4be0aac
commit
b12aecb5ad
3 changed files with 15 additions and 3 deletions
|
|
@ -139,6 +139,7 @@ export const Table = React.memo(
|
|||
const updatedDataReference = useRef([]);
|
||||
const preSelectRow = useRef(false);
|
||||
const initialPageCountRef = useRef(null);
|
||||
const isInitialRender = useRef(true);
|
||||
const allAppEvents = useEvents();
|
||||
// const { events: allAppEvents } = useAppInfo();
|
||||
const tableEvents = allAppEvents.filter((event) => event.target === 'component' && event.sourceId === id);
|
||||
|
|
@ -577,8 +578,10 @@ export const Table = React.memo(
|
|||
dynamicColumn,
|
||||
setComponentProperty,
|
||||
properties.autogenerateColumns ?? false,
|
||||
id
|
||||
id,
|
||||
isInitialRender.current
|
||||
);
|
||||
isInitialRender.current = false;
|
||||
if (useDynamicColumn) {
|
||||
const dynamicColumnHasId = dynamicColumn && dynamicColumn.every((column) => 'id' in column);
|
||||
if (!dynamicColumnHasId) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ export default function autogenerateColumns(
|
|||
dynamicColumn = [],
|
||||
setProperty,
|
||||
generateNestedColumns,
|
||||
id
|
||||
id,
|
||||
isInitialRender
|
||||
) {
|
||||
if (useDynamicColumn) {
|
||||
if (dynamicColumn.length > 0 && dynamicColumn[0].name) {
|
||||
|
|
@ -107,7 +108,14 @@ export default function autogenerateColumns(
|
|||
finalKeys.includes(column?.key || column?.name)
|
||||
);
|
||||
|
||||
setTimeout(() => setProperty(id, 'columns', finalColumns, 'properties'), 10);
|
||||
setTimeout(
|
||||
() =>
|
||||
setProperty(id, 'columns', finalColumns, 'properties', undefined, undefined, undefined, {
|
||||
skipUndoRedo: isInitialRender,
|
||||
saveAfterAction: true,
|
||||
}),
|
||||
10
|
||||
);
|
||||
}
|
||||
|
||||
const dataTypeToColumnTypeMapping = {
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ export const createUndoRedoSlice = (set, get) => {
|
|||
componenetPropertiesToUpdate.paramType,
|
||||
componenetPropertiesToUpdate.attr,
|
||||
undefined,
|
||||
undefined,
|
||||
{ skipUndoRedo: true }
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue