Skip to content

Commit

Permalink
[#1134] Save Button Bugs on Datapoint Editing
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek-p-s committed Feb 6, 2024
1 parent 52be05c commit e098ead
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frontend/src/pages/manage-data/DataDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ const DataDetail = ({
const [dataset, setDataset] = useState([]);
const [loading, setLoading] = useState(false);
const [saving, setSaving] = useState(false);
const [resetButton, setresetButton] = useState({});
const pendingData = record?.pending_data?.created_by || false;
const { user: authUser, forms } = store.useState((state) => state);
const { notify } = useNotification();

const updateCell = (key, parentId, value) => {
setresetButton({ ...resetButton, [key]: true });
let prev = JSON.parse(JSON.stringify(dataset));
prev = prev.map((qg) =>
qg.id === parentId
Expand Down Expand Up @@ -105,6 +107,11 @@ const DataDetail = ({
: record.id
);
fetchData(record.id);
const resetObj = {};
data.map((d) => {
resetObj[d.question] = false;
});
setresetButton({ ...resetButton, ...resetObj });
})
.catch((e) => {
console.error(e);
Expand Down Expand Up @@ -218,6 +225,7 @@ const DataDetail = ({
resetCell={resetCell}
pendingData={pendingData}
isPublic={isPublic}
resetButton={resetButton}
/>
),
},
Expand Down

0 comments on commit e098ead

Please sign in to comment.