Skip to content

Commit e47b7d5

Browse files
debug: form issue
1 parent 8757e49 commit e47b7d5

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/components/Section.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ interface Props {
2121

2222
export const Section: React.FC<Props> = props => {
2323
const [isDragging, setIsDragging] = useState(false);
24-
console.log("SECTION props.church", props.church)
2524

2625

2726
const getElements = () => {

src/components/SectionBlock.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ interface Props {
1616
}
1717

1818
export const SectionBlock: React.FC<Props> = props => {
19-
console.log("SECTION BLOCK")
2019

2120
const getEdit = () => {
2221
if (props.onEdit) {

src/components/elementTypes/FormElement.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const FormElement = (props: Props) => {
1313
const [isFormSubmitted, setIsFormSubmitted] = useState<boolean>(false);
1414
const [unRestrictedFormId, setUnRestrictedFormId] = useState<string>("");
1515
const formId = props.element.answers.formId;
16+
const [currentChurch, setCurrentChurch] = useState<ChurchInterface>(props.church);
1617

1718
console.log("church: ", props.church);
1819
console.log("formId: ", formId);
@@ -21,10 +22,16 @@ export const FormElement = (props: Props) => {
2122

2223

2324
useEffect(() => {
24-
if (formId && props.church) {
25+
console.log("changing church:");
26+
setCurrentChurch(props.church);
27+
}, [props.church]);
28+
29+
useEffect(() => {
30+
console.log("church prop changed: ")
31+
if (formId && currentChurch) {
2532
loadData();
2633
}
27-
}, [formId, props.church]);
34+
}, [formId, currentChurch]);
2835

2936
const loadData = () => {
3037
ApiHelper.get(

0 commit comments

Comments
 (0)