Skip to content

Commit

Permalink
[#521] Fix active Submit button on last question group
Browse files Browse the repository at this point in the history
  • Loading branch information
wayangalihpratama committed Mar 6, 2024
1 parent 5ac933a commit 53888bf
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions frontend/src/akvo-react-form/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ import { Row, Col, Button, Form, Space, Select, message } from "antd";
// import "antd/dist/antd.min.css";
import "./styles.css";
import moment from "moment";
import { range, intersection, maxBy, isEmpty, takeRight, take } from "lodash";
import {
range,
intersection,
maxBy,
isEmpty,
takeRight,
take,
last,
} from "lodash";
import {
transformForm,
translateForm,
Expand Down Expand Up @@ -504,8 +512,9 @@ export const Webform = ({
};

const isLastGroup = useMemo(() => {
return activeGroup + 1 === formsMemo?.question_group?.length;
}, [activeGroup, formsMemo]);
const lastShownGroup = last(showGroup);
return activeGroup === lastShownGroup;
}, [activeGroup, showGroup]);

if (!formsMemo?.question_group) {
return "Error Format";
Expand Down

0 comments on commit 53888bf

Please # to comment.