2
0

🐛 (analytics) Fix previous total computation max call stack exceeded

Closes #624
This commit is contained in:
Baptiste Arnaud
2023-07-25 17:29:06 +02:00
parent 4607f0ea39
commit 7a7d471805
3 changed files with 5 additions and 3 deletions

View File

@ -16,7 +16,7 @@ export const computePreviousTotalAnswers = (
const currentBlockIndex = currentGroup.blocks.findIndex(
(block) => block.id === currentBlockId
)
const previousBlocks = currentGroup.blocks.slice(0, currentBlockIndex)
const previousBlocks = currentGroup.blocks.slice(0, currentBlockIndex + 1)
for (const block of previousBlocks.reverse()) {
if (isInputBlock(block) || block.type === 'start')
return (

View File

@ -167,7 +167,6 @@ export const DropOffEdge = ({
} left. This represents ${dropOffRate}% of the users who saw this input.`
: 'Upgrade your plan to PRO to reveal drop-off rate.'
}
isDisabled={isWorkspaceProPlan}
placement="top"
>
<VStack

View File

@ -21,6 +21,7 @@ import {
import { useGraph } from '@/features/graph/providers/GraphProvider'
import { setMultipleRefs } from '@/helpers/setMultipleRefs'
import { ConditionContent } from '@/features/blocks/logic/condition/components/ConditionContent'
import { useRouter } from 'next/router'
type Props = {
item: Item
@ -43,6 +44,7 @@ export const ItemNode = ({
const bg = useColorModeValue('white', 'gray.850')
const { typebot } = useTypebot()
const { previewingEdge } = useGraph()
const { pathname } = useRouter()
const [isMouseOver, setIsMouseOver] = useState(false)
const itemRef = useRef<HTMLDivElement | null>(null)
const isPreviewing = previewingEdge?.from.itemId === item.id
@ -110,7 +112,7 @@ export const ItemNode = ({
isMouseOver={isMouseOver}
indices={indices}
/>
{typebot && isConnectable && (
{typebot && (isConnectable || pathname.endsWith('analytics')) && (
<SourceEndpoint
source={{
groupId: typebot.groups[indices.groupIndex].id,
@ -121,6 +123,7 @@ export const ItemNode = ({
right="-49px"
bottom="9px"
pointerEvents="all"
isHidden={!isConnectable}
/>
)}
</Flex>