mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 10:19:51 -06:00
fix: unformatted recall question in logic editor (#2126)
This commit is contained in:
committed by
GitHub
parent
a027d1ef3d
commit
60b474a4f9
@@ -4,6 +4,7 @@ import { useMemo } from "react";
|
||||
import { toast } from "react-hot-toast";
|
||||
import { BsArrowDown, BsArrowReturnRight } from "react-icons/bs";
|
||||
|
||||
import { checkForRecallInHeadline } from "@formbricks/lib/utils/recall";
|
||||
import {
|
||||
TSurvey,
|
||||
TSurveyLogic,
|
||||
@@ -44,6 +45,10 @@ export default function LogicEditor({
|
||||
questionIdx,
|
||||
updateQuestion,
|
||||
}: LogicEditorProps): JSX.Element {
|
||||
localSurvey = useMemo(() => {
|
||||
return checkForRecallInHeadline(localSurvey);
|
||||
}, [localSurvey]);
|
||||
|
||||
const questionValues = useMemo(() => {
|
||||
if ("choices" in question) {
|
||||
return question.choices.map((choice) => choice.label);
|
||||
|
||||
@@ -102,7 +102,7 @@ export const checkForEmptyFallBackValue = (survey: TSurvey): TSurveyQuestion | n
|
||||
|
||||
// Processes each question in a survey to ensure headlines are formatted correctly for recall and return the modified survey.
|
||||
export const checkForRecallInHeadline = (survey: TSurvey): TSurvey => {
|
||||
const modifiedSurvey = { ...survey };
|
||||
const modifiedSurvey = structuredClone(survey);
|
||||
modifiedSurvey.questions.forEach((question) => {
|
||||
question.headline = recallToHeadline(question.headline, modifiedSurvey, false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user