Skip to content

Commit

Permalink
chat height default unit is px (#1681)
Browse files Browse the repository at this point in the history
resolves #1586

Co-authored-by: Fred Lefévère-Laoide <[email protected]>
  • Loading branch information
FredLL-Avaiga and Fred Lefévère-Laoide authored Aug 20, 2024
1 parent 43c241c commit 06aba3e
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, page: number) => `Chat-${start}-${start+page}`
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 All @@ -184,7 +184,7 @@ const Chat = (props: ChatProps) => {
props.height
? ({
...defaultBoxSx,
maxHeight: props.height,
maxHeight: "" + Number(props.height) == "" + props.height ? props.height + "px" : props.height,
display: "flex",
flexDirection: "column",
} as SxProps<Theme>)
Expand Down Expand Up @@ -291,14 +291,14 @@ const Chat = (props: ChatProps) => {
if (!refresh && props.messages && page.current.key && props.messages[page.current.key] !== undefined) {
const newValue = props.messages[page.current.key];
if (newValue.rowcount == 0) {
setRows(emptyArray)
setRows(emptyArray);
} else {
const nr = newValue.data as RowType[];
if (Array.isArray(nr) && nr.length > newValue.start && nr[newValue.start]) {
setRows((old) => {
old.length && nr.length > old.length && setShowMessage(true);
if (nr.length < old.length) {
return nr.concat(old.slice(nr.length))
return nr.concat(old.slice(nr.length));
}
if (old.length > newValue.start) {
return old.slice(0, newValue.start).concat(nr.slice(newValue.start));
Expand Down

0 comments on commit 06aba3e

Please sign in to comment.