fix: update error
This commit is contained in:
parent
ad8f362744
commit
c3c3cc18b2
|
|
@ -288,11 +288,11 @@ export default function ContentBlast() {
|
|||
<div className="flex gap-6">
|
||||
<label className="flex items-center gap-2">
|
||||
<Checkbox
|
||||
checked={field.value.includes("wa")}
|
||||
checked={field.value?.includes("wa") ?? false}
|
||||
onCheckedChange={(checked) => {
|
||||
checked
|
||||
? field.onChange([...field.value, "wa"])
|
||||
: field.onChange(field.value.filter((v) => v !== "wa"));
|
||||
? field.onChange([...(field.value ?? []), "wa"])
|
||||
: field.onChange((field.value ?? []).filter((v) => v !== "wa"));
|
||||
}}
|
||||
/>
|
||||
WhatsApp
|
||||
|
|
@ -300,12 +300,12 @@ export default function ContentBlast() {
|
|||
|
||||
<label className="flex items-center gap-2">
|
||||
<Checkbox
|
||||
checked={field.value.includes("email")}
|
||||
checked={field.value?.includes("email") ?? false}
|
||||
onCheckedChange={(checked) => {
|
||||
checked
|
||||
? field.onChange([...field.value, "email"])
|
||||
? field.onChange([...(field.value ?? []), "email"])
|
||||
: field.onChange(
|
||||
field.value.filter((v) => v !== "email")
|
||||
(field.value ?? []).filter((v) => v !== "email")
|
||||
);
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -1748,13 +1748,13 @@ export default function FormAudio() {
|
|||
|
||||
{options.map((option) => {
|
||||
const isAllChecked =
|
||||
field.value.length ===
|
||||
(field.value?.length ?? 0) ===
|
||||
options.filter((opt: any) => opt.id !== "all").length;
|
||||
|
||||
const isChecked =
|
||||
option.id === "all"
|
||||
? isAllChecked
|
||||
: field.value.includes(option.id);
|
||||
: field.value?.includes(option.id) ?? false;
|
||||
|
||||
const handleChange = () => {
|
||||
let updated: string[] = [];
|
||||
|
|
@ -1767,8 +1767,8 @@ export default function FormAudio() {
|
|||
.map((opt: any) => opt.id);
|
||||
} else {
|
||||
updated = isChecked
|
||||
? field.value.filter((val) => val !== option.id)
|
||||
: [...field.value, option.id];
|
||||
? (field.value ?? []).filter((val) => val !== option.id)
|
||||
: [...(field.value ?? []), option.id];
|
||||
|
||||
if (isAllChecked && option.id !== "all") {
|
||||
updated = updated.filter((val) => val !== "all");
|
||||
|
|
|
|||
|
|
@ -1673,13 +1673,13 @@ export default function FormImage() {
|
|||
|
||||
{options.map((option) => {
|
||||
const isAllChecked =
|
||||
field.value.length ===
|
||||
(field.value?.length ?? 0) ===
|
||||
options.filter((opt: any) => opt.id !== "all").length;
|
||||
|
||||
const isChecked =
|
||||
option.id === "all"
|
||||
? isAllChecked
|
||||
: field.value.includes(option.id);
|
||||
: field.value?.includes(option.id) ?? false;
|
||||
|
||||
const handleChange = () => {
|
||||
let updated: string[] = [];
|
||||
|
|
@ -1692,8 +1692,8 @@ export default function FormImage() {
|
|||
.map((opt: any) => opt.id);
|
||||
} else {
|
||||
updated = isChecked
|
||||
? field.value.filter((val) => val !== option.id)
|
||||
: [...field.value, option.id];
|
||||
? (field.value ?? []).filter((val) => val !== option.id)
|
||||
: [...(field.value ?? []), option.id];
|
||||
|
||||
if (isAllChecked && option.id !== "all") {
|
||||
updated = updated.filter((val) => val !== "all");
|
||||
|
|
|
|||
|
|
@ -1715,13 +1715,13 @@ export default function FormTeks() {
|
|||
|
||||
{options.map((option) => {
|
||||
const isAllChecked =
|
||||
field.value.length ===
|
||||
(field.value?.length ?? 0) ===
|
||||
options.filter((opt: any) => opt.id !== "all").length;
|
||||
|
||||
const isChecked =
|
||||
option.id === "all"
|
||||
? isAllChecked
|
||||
: field.value.includes(option.id);
|
||||
: field.value?.includes(option.id) ?? false;
|
||||
|
||||
const handleChange = () => {
|
||||
let updated: string[] = [];
|
||||
|
|
@ -1734,8 +1734,8 @@ export default function FormTeks() {
|
|||
.map((opt: any) => opt.id);
|
||||
} else {
|
||||
updated = isChecked
|
||||
? field.value.filter((val) => val !== option.id)
|
||||
: [...field.value, option.id];
|
||||
? (field.value ?? []).filter((val) => val !== option.id)
|
||||
: [...(field.value ?? []), option.id];
|
||||
|
||||
if (isAllChecked && option.id !== "all") {
|
||||
updated = updated.filter((val) => val !== "all");
|
||||
|
|
|
|||
|
|
@ -1713,7 +1713,7 @@ export default function FormVideo() {
|
|||
if (e.key === "Enter" && e.currentTarget.value.trim()) {
|
||||
e.preventDefault();
|
||||
field.onChange([
|
||||
...field.value,
|
||||
...(field.value ?? []),
|
||||
e.currentTarget.value.trim(),
|
||||
]);
|
||||
e.currentTarget.value = "";
|
||||
|
|
@ -1722,7 +1722,7 @@ export default function FormVideo() {
|
|||
/>
|
||||
|
||||
<div className="mt-3">
|
||||
{field.value.map((tag: string, index: number) => (
|
||||
{(field.value ?? []).map((tag: string, index: number) => (
|
||||
<span
|
||||
key={index}
|
||||
className="px-1 py-1 rounded-lg bg-black text-white mr-2 text-sm font-sans"
|
||||
|
|
@ -1731,7 +1731,7 @@ export default function FormVideo() {
|
|||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
const updatedTags = field.value.filter(
|
||||
const updatedTags = (field.value ?? []).filter(
|
||||
(_, i) => i !== index
|
||||
);
|
||||
field.onChange(updatedTags);
|
||||
|
|
@ -1764,13 +1764,13 @@ export default function FormVideo() {
|
|||
|
||||
{options.map((option) => {
|
||||
const isAllChecked =
|
||||
field.value.length ===
|
||||
(field.value?.length ?? 0) ===
|
||||
options.filter((opt: any) => opt.id !== "all").length;
|
||||
|
||||
const isChecked =
|
||||
option.id === "all"
|
||||
? isAllChecked
|
||||
: field.value.includes(option.id);
|
||||
: field.value?.includes(option.id) ?? false;
|
||||
|
||||
const handleChange = () => {
|
||||
let updated: string[] = [];
|
||||
|
|
@ -1783,8 +1783,8 @@ export default function FormVideo() {
|
|||
.map((opt: any) => opt.id);
|
||||
} else {
|
||||
updated = isChecked
|
||||
? field.value.filter((val) => val !== option.id)
|
||||
: [...field.value, option.id];
|
||||
? (field.value ?? []).filter((val) => val !== option.id)
|
||||
: [...(field.value ?? []), option.id];
|
||||
|
||||
if (isAllChecked && option.id !== "all") {
|
||||
updated = updated.filter((val) => val !== "all");
|
||||
|
|
|
|||
Loading…
Reference in New Issue