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( const currentBlockIndex = currentGroup.blocks.findIndex(
(block) => block.id === currentBlockId (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()) { for (const block of previousBlocks.reverse()) {
if (isInputBlock(block) || block.type === 'start') if (isInputBlock(block) || block.type === 'start')
return ( return (

View File

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

View File

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