Skip to content

Commit

Permalink
pagesize in data key
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred Lefévère-Laoide authored and Fred Lefévère-Laoide committed May 17, 2024
1 parent ac9471f commit d3c429b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions frontend/taipy-gui/src/components/Taipy/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const ChatRow = (props: ChatRowProps) => {
);
};

const getChatKey = (start: number) => `Chat-${start}`
const getChatKey = (start: number, page: number) => `Chat-${start}-${start+page}`

const Chat = (props: ChatProps) => {
const { id, updateVarName, senderId = "taipy", onAction, withInput = true, defaultKey = "", pageSize = 50 } = props;
Expand Down Expand Up @@ -250,7 +250,7 @@ const Chat = (props: ChatProps) => {

const loadMoreItems = useCallback(
(startIndex: number) => {
const key = getChatKey(startIndex);
const key = getChatKey(startIndex, pageSize);
page.current = {
key: key,
};
Expand Down Expand Up @@ -307,9 +307,9 @@ const Chat = (props: ChatProps) => {
const cols = Object.keys(nr[newValue.start]);
setColumns(cols.length > 2 ? cols : cols.length == 2 ? [...cols, ""] : ["", ...cols, "", ""]);
}
page.current.key = getChatKey(0);
page.current.key = getChatKey(0, pageSize);
}
}, [refresh, props.messages]);
}, [refresh, pageSize, props.messages]);

useEffect(() => {
if (showMessage && !isAnchorDivVisible) {
Expand Down

0 comments on commit d3c429b

Please sign in to comment.