Skip to content

Commit

Permalink
fix: checkbox options not updated (#1000)
Browse files Browse the repository at this point in the history
* fix: remove value from builder checkbox field

* feat: disable reset when saving
  • Loading branch information
lamkeewei authored Sep 1, 2021
1 parent d58a7b8 commit a877f4e
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/client/components/builder/constants/MapTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ const InputComponent: ConstantFieldComponent = ({
<HStack>
{isChanged && (
<Button
isDisabled={save.isLoading}
colorScheme="primary"
variant="outline"
onClick={() => reset(undefined, { keepValues: false })}
Expand Down
1 change: 1 addition & 0 deletions src/client/components/builder/logic/CalculatedResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ const InputComponent: OperationFieldComponent = ({
<HStack>
{isChanged && (
<Button
isDisabled={save.isLoading}
colorScheme="primary"
variant="outline"
onClick={() => reset(undefined, { keepValues: false })}
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/builder/logic/ConditionalResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ const InputComponent: OperationFieldComponent = ({
<HStack>
{isChanged && (
<Button
isLoading={save.isLoading}
isDisabled={save.isLoading}
colorScheme="primary"
variant="outline"
onClick={() => reset(undefined, { keepValues: false })}
Expand Down
1 change: 1 addition & 0 deletions src/client/components/builder/logic/DateResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ const InputComponent: OperationFieldComponent = ({
<HStack>
{isChanged && (
<Button
isDisabled={save.isLoading}
colorScheme="primary"
variant="outline"
onClick={() => reset(undefined, { keepValues: false })}
Expand Down
1 change: 1 addition & 0 deletions src/client/components/builder/logic/MapResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ const InputComponent: OperationFieldComponent = ({
<HStack>
{isChanged && (
<Button
isDisabled={save.isLoading}
colorScheme="primary"
variant="outline"
onClick={() => reset(undefined, { keepValues: false })}
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/builder/questions/CheckboxField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ const InputComponent: QuestionFieldComponent = ({ field, index, toolbar }) => {
/>
<Input
type="text"
value={option.label}
{...register(`options.${i}.label`, {
required: { value: true, message: 'Option value cannot be empty' },
})}
Expand Down Expand Up @@ -181,6 +180,7 @@ const InputComponent: QuestionFieldComponent = ({ field, index, toolbar }) => {
<HStack>
{isChanged && (
<Button
isDisabled={save.isLoading}
colorScheme="primary"
variant="outline"
onClick={() => reset(undefined, { keepValues: false })}
Expand Down
1 change: 1 addition & 0 deletions src/client/components/builder/questions/DateField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const InputComponent: QuestionFieldComponent = ({ field, index, toolbar }) => {
<HStack>
{isChanged && (
<Button
isDisabled={save.isLoading}
colorScheme="primary"
variant="outline"
onClick={() => reset(undefined, { keepValues: false })}
Expand Down
1 change: 1 addition & 0 deletions src/client/components/builder/questions/DropdownField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ const InputComponent: QuestionFieldComponent = ({ field, index, toolbar }) => {
<HStack>
{isChanged && (
<Button
isDisabled={save.isLoading}
colorScheme="primary"
variant="outline"
onClick={() => reset(undefined, { keepValues: false })}
Expand Down
1 change: 1 addition & 0 deletions src/client/components/builder/questions/NumericField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ const InputComponent: QuestionFieldComponent = ({ field, index, toolbar }) => {
<HStack>
{isChanged && (
<Button
isDisabled={save.isLoading}
colorScheme="primary"
variant="outline"
onClick={() => reset(undefined, { keepValues: false })}
Expand Down
1 change: 1 addition & 0 deletions src/client/components/builder/questions/RadioField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ const InputComponent: QuestionFieldComponent = ({ field, index, toolbar }) => {
<HStack>
{isChanged && (
<Button
isDisabled={save.isLoading}
colorScheme="primary"
variant="outline"
onClick={() => reset(undefined, { keepValues: false })}
Expand Down
1 change: 1 addition & 0 deletions src/client/components/builder/questions/TitleField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const InputComponent: TitleFieldComponent = ({ title, description }) => {
<HStack>
{isChanged && (
<Button
isDisabled={save.isLoading}
colorScheme="primary"
variant="outline"
onClick={() => reset(undefined, { keepValues: false })}
Expand Down

0 comments on commit a877f4e

Please sign in to comment.