🐛 Fix formatted message in input block when input is retried
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typebot.io/js",
|
||||
"version": "0.2.10",
|
||||
"version": "0.2.11",
|
||||
"description": "Javascript library to display typebots on your website",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
|
@ -171,7 +171,7 @@ export const ConversationContainer = (props: Props) => {
|
||||
setFormattedMessages([
|
||||
...formattedMessages(),
|
||||
{
|
||||
inputId: [...chatChunks()].pop()?.input?.id ?? '',
|
||||
inputIndex: [...chatChunks()].length - 1,
|
||||
formattedMessage: data.lastMessageNewFormat as string,
|
||||
},
|
||||
])
|
||||
|
@ -63,8 +63,8 @@ export const InputChatBlock = (props: Props) => {
|
||||
}
|
||||
|
||||
createEffect(() => {
|
||||
const formattedMessage = formattedMessages().find(
|
||||
(message) => message.inputId === props.block.id
|
||||
const formattedMessage = formattedMessages().findLast(
|
||||
(message) => props.inputIndex === message.inputIndex
|
||||
)?.formattedMessage
|
||||
if (formattedMessage) setFormattedMessage(formattedMessage)
|
||||
})
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { createSignal } from 'solid-js'
|
||||
|
||||
export const [formattedMessages, setFormattedMessages] = createSignal<
|
||||
{ inputId: string; formattedMessage: string }[]
|
||||
{ inputIndex: number; formattedMessage: string }[]
|
||||
>([])
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typebot.io/nextjs",
|
||||
"version": "0.2.10",
|
||||
"version": "0.2.11",
|
||||
"description": "Convenient library to display typebots on your Next.js website",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typebot.io/react",
|
||||
"version": "0.2.10",
|
||||
"version": "0.2.11",
|
||||
"description": "Convenient library to display typebots on your React app",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
Reference in New Issue
Block a user