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