Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
80a2d08
upgrade react-resize-detector, replace ReactResizeDetector comp with …
raheeliftikhar5 Apr 29, 2025
e2a39ef
upgrade react-draggable, added missing nodeRef
raheeliftikhar5 Apr 29, 2025
2130263
replaced react-quill with react-quill-new
raheeliftikhar5 Apr 29, 2025
9ae9a9c
removed react-sortabled-hoc, used dnd-kit for sorting
raheeliftikhar5 Apr 29, 2025
8266951
fix icon comp, icon button when no icon is selected
raheeliftikhar5 Apr 29, 2025
61d5a45
added memoization on table comp
raheeliftikhar5 Apr 29, 2025
41f6276
upgrade comps
raheeliftikhar5 Apr 29, 2025
73c613b
build lowcoder-core after upgrading react version
raheeliftikhar5 Apr 29, 2025
e7c960b
upgraded react, react-dom in lowcoderc-comps + replaced ReactResizeDe…
raheeliftikhar5 Apr 29, 2025
2e1fd49
upgrade packages
raheeliftikhar5 Apr 29, 2025
eae5b3d
optimise drawer comp
raheeliftikhar5 May 21, 2025
9cac3cf
optimise lowcoder-design components
raheeliftikhar5 May 21, 2025
c2c88ec
optimise shared components
raheeliftikhar5 May 21, 2025
707e3e0
optimise table comp, toolbar, filters, summary rows and different col…
raheeliftikhar5 May 21, 2025
405822b
optimise button component
raheeliftikhar5 May 21, 2025
da075f5
optimise editor view
raheeliftikhar5 May 21, 2025
0543b12
optimise canvas view/inner grid, root comp, gridLayout, gridItem and …
raheeliftikhar5 May 21, 2025
05ee98b
optimise form components
raheeliftikhar5 May 21, 2025
c2680f3
optimise modal comp
raheeliftikhar5 May 21, 2025
371a9bc
optimise event handler control
raheeliftikhar5 May 21, 2025
6ef3c5e
remove antd's react 19 patch
raheeliftikhar5 May 21, 2025
6ab43b4
fixed query variable value when used with event handler control
raheeliftikhar5 May 21, 2025
0bdc38c
Merge branch 'dev' into feature/support-react-19
FalkWolsky May 22, 2025
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
Next Next commit
added memoization on table comp
  • Loading branch information
raheeliftikhar5 committed May 22, 2025
commit 61d5a454425f83ac5c598b3b27fa9015f40de281
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ interface EditableCellProps<T> extends CellProps {
changeValue?: T | null;
}

export function EditableCell<T extends JSONValue>(props: EditableCellProps<T>) {
function EditableCellComp<T extends JSONValue>(props: EditableCellProps<T>) {
const {
dispatch,
normalView,
Expand Down Expand Up @@ -157,9 +157,10 @@ export function EditableCell<T extends JSONValue>(props: EditableCellProps<T>) {
<ColumnTypeView
textOverflow={props.textOverflow}
>
{status === "toSave" && !isEditing && <EditableChip />}
{status === "toSave" && !isEditing && <EditableChip key={`editable-chip`}/>}
<CellWrapper tooltipTitle={props.cellTooltip}>
<div
key={`normal-view`}
tabIndex={editable ? 0 : -1 }
onFocus={enterEditFn}
>
Expand All @@ -170,6 +171,7 @@ export function EditableCell<T extends JSONValue>(props: EditableCellProps<T>) {
{editable && (
<CellWrapper tooltipTitle={props.cellTooltip}>
<div
key={`editable-view`}
style={{
position: 'absolute',
top: 0,
Expand All @@ -186,3 +188,5 @@ export function EditableCell<T extends JSONValue>(props: EditableCellProps<T>) {
</ColumnTypeView>
);
}

export const EditableCell = React.memo(EditableCellComp) as typeof EditableCellComp;
36 changes: 22 additions & 14 deletions client/packages/lowcoder/src/components/table/columnTypeView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useMemo, useRef, useState } from "react";
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
import styled from "styled-components";

const ColumnTypeViewWrapper = styled.div<{
Expand Down Expand Up @@ -73,13 +73,13 @@ function childIsOverflow(nodes: HTMLCollection): boolean {
return false;
}

export default function ColumnTypeView(props: {
function ColumnTypeView(props: {
children: React.ReactNode,
textOverflow?: boolean,
}) {

const wrapperRef = useRef<HTMLDivElement>(null);
const hoverViewRef = useRef<HTMLDivElement>(null);
const wrapperRef = useRef<HTMLDivElement | null>(null);
const hoverViewRef = useRef<HTMLDivElement | null>(null);
const [isHover, setIsHover] = useState(false);
const [hasOverflow, setHasOverflow] = useState(false);
const [adjustedPosition, setAdjustedPosition] = useState<{
Expand All @@ -90,13 +90,12 @@ export default function ColumnTypeView(props: {
width?: number;
}>({ done: false });
const [delayHandler, setDelayHandler] = useState<any>();
const delayMouseEnter = useMemo(() => {
return () =>
setDelayHandler(
setTimeout(() => {
setIsHover(true);
}, 300)
);
const delayMouseEnter = useCallback(() => {
setDelayHandler(
setTimeout(() => {
setIsHover(true);
}, 300)
);
}, []);

useEffect(() => {
Expand Down Expand Up @@ -172,14 +171,21 @@ export default function ColumnTypeView(props: {
});
}, [isHover, hasOverflow]);

useEffect(() => {
return () => {
hoverViewRef.current = null;
wrapperRef.current = null;

clearTimeout(delayHandler);
}
}, [])

return (
<>
<ColumnTypeViewWrapper
ref={wrapperRef}
$textOverflow={props.textOverflow}
onMouseEnter={() => {
delayMouseEnter();
}}
onMouseEnter={delayMouseEnter}
onMouseLeave={() => {
clearTimeout(delayHandler);
setIsHover(false);
Expand Down Expand Up @@ -208,3 +214,5 @@ export default function ColumnTypeView(props: {
</>
);
}

export default React.memo(ColumnTypeView);
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { disabledPropertyView, hiddenPropertyView } from "comps/utils/propertyUt
import { DisabledContext } from "comps/generators/uiCompBuilder";
import { SliderControl } from "@lowcoder-ee/comps/controls/sliderControl";
import { getBackgroundStyle } from "@lowcoder-ee/util/styleUtils";
import React from "react";

const ContainWrapper = styled.div<{
$style: ContainerStyleType & {
Expand Down Expand Up @@ -212,6 +213,7 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
const containerProps = containers[id].children;
const noOfColumns = columns.length;
return (
<React.Fragment key={id}>
<BackgroundColorContext.Provider value={props.columnStyle.background}>
<ColWrapper
key={id}
Expand All @@ -230,6 +232,7 @@ const ColumnLayout = (props: ColumnLayoutProps) => {
/>
</ColWrapper>
</BackgroundColorContext.Provider>
</React.Fragment>
)
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ class DragSelectorComp extends React.Component<SectionProps, SectionState> {
this._onMouseUp = this._onMouseUp.bind(this);
}

componentWillUnmount(): void {
window.document.removeEventListener("mousemove", this._onMouseMove);
window.document.removeEventListener("mouseup", this._onMouseUp);
}

_onMouseDown(e: React.MouseEvent<HTMLDivElement>) {
if (e.button === 2 || e.nativeEvent.which === 2) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export const ColumnTagsComp = (function () {
// The actual eval value is of type number or boolean
const tagText = String(tag);
return (
<div>
<div key={`${tag.split(' ').join('_')}-${index}`}>
<TagStyled color={getTagColor(tagText, tagOptions)} icon={getTagIcon(tagText, tagOptions)} key={index} >
{tagText}
</TagStyled>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ type CustomTableProps<RecordType> = Omit<TableProps<RecordType>, "components" |
onCellClick: (columnName: string, dataIndex: string) => void;
};

function TableCellView(props: {
const TableCellView = React.memo((props: {
record: RecordType;
title: string;
rowColorFn: RowColorViewType;
Expand All @@ -565,7 +565,7 @@ function TableCellView(props: {
tableSize?: string;
autoHeight?: boolean;
loading?: boolean;
}) {
}) => {
const {
record,
title,
Expand Down Expand Up @@ -648,9 +648,9 @@ function TableCellView(props: {
{tdView}
</TableCellContext.Provider>
);
}
});

function TableRowView(props: any) {
const TableRowView = React.memo((props: any) => {
const [hover, setHover] = useState(false);
const [selected, setSelected] = useState(false);
return (
Expand All @@ -665,12 +665,12 @@ function TableRowView(props: any) {
></tr>
</TableRowContext.Provider>
);
}
});

/**
* A table with adjustable column width, width less than 0 means auto column width
*/
function ResizeableTable<RecordType extends object>(props: CustomTableProps<RecordType>) {
function ResizeableTableComp<RecordType extends object>(props: CustomTableProps<RecordType>) {
const [resizeData, setResizeData] = useState({
index: -1,
width: -1,
Expand Down Expand Up @@ -760,8 +760,10 @@ function ResizeableTable<RecordType extends object>(props: CustomTableProps<Reco
></Table>
);
}
ResizeableTableComp.whyDidYouRender = true;

const ResizeableTable = React.memo(ResizeableTableComp) as typeof ResizeableTableComp;

ResizeableTable.whyDidYouRender = true;

const createNewEmptyRow = (
rowIndex: number,
Expand All @@ -776,11 +778,11 @@ const createNewEmptyRow = (
return emptyRowData;
}

export function TableCompView(props: {
export const TableCompView = React.memo((props: {
comp: InstanceType<typeof TableImplComp>;
onRefresh: (allQueryNames: Array<string>, setLoading: (loading: boolean) => void) => void;
onDownload: (fileName: string) => void;
}) {
}) => {
const [emptyRowsMap, setEmptyRowsMap] = useState<Record<string, RecordType>>({});
const editorState = useContext(EditorContext);
const currentTheme = useContext(ThemeContext)?.theme;
Expand Down Expand Up @@ -1101,4 +1103,4 @@ export function TableCompView(props: {

</BackgroundColorContext.Provider>
);
}
});