Skip to content

Commit 8665544

Browse files
committed
feat(resize) apply changes without null
1 parent 2647759 commit 8665544

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@table-library/react-table-library",
3-
"version": "2.0.16",
3+
"version": "2.0.17",
44
"description": "react-table-library",
55
"type": "module",
66
"main": "main.js",

src/resize/useConsumeRowLayout.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ export const useConsumeRowLayout = (ref: TableElementRef, selector: string) => {
2828
allCells.forEach((cell, index) => {
2929
if (tableMemoryRef.current!.resizedLayout[index] === null) return;
3030

31-
cell.setAttribute(
32-
'style',
33-
`${cell.getAttribute('style')}` +
34-
`width: ${tableMemoryRef.current!.resizedLayout[index]}; min-width: ${
35-
tableMemoryRef.current!.resizedLayout[index]
36-
};`,
37-
);
31+
const previousStyle = cell.getAttribute('style') ?? '';
32+
const widthStyle = `
33+
width: ${tableMemoryRef.current!.resizedLayout[index]};
34+
min-width: ${tableMemoryRef.current!.resizedLayout[index]};
35+
`;
36+
37+
cell.setAttribute('style', previousStyle + ' ' + widthStyle);
3838
});
3939
}, [ref, layout, selector, tableMemoryRef]);
4040
};

0 commit comments

Comments
 (0)