fix file, image table cells not getting doc ref

This commit is contained in:
Sidney Alcantara
2022-05-30 13:21:07 +10:00
parent 8e303bf5f3
commit 6030041557
4 changed files with 12 additions and 8 deletions

View File

@@ -53,7 +53,7 @@ function ControlledFileUploader({
if (docRef && file) {
upload({
docRef: docRef as any,
docRef: docRef! as any,
fieldName: column.key,
files: [file],
previousValue: value ?? [],

View File

@@ -23,6 +23,7 @@ export default function File_({
value,
onSubmit,
disabled,
docRef,
}: IHeavyCellProps) {
const confirm = useSetAtom(confirmDialogAtom, globalScope);
const updateField = useSetAtom(updateFieldAtom, tableScope);
@@ -36,13 +37,13 @@ export default function File_({
if (file) {
upload({
docRef: row.ref,
docRef: docRef! as any,
fieldName: column.key,
files: [file],
previousValue: value,
onComplete: (newValue) => {
updateField({
path: row._rowy_ref.path,
path: docRef.path,
fieldName: column.key,
value: newValue,
});
@@ -139,12 +140,13 @@ export default function File_({
!disabled && (
<IconButton
size="small"
className="row-hover-iconButton"
onClick={(e) => {
dropzoneProps.onClick!(e);
e.stopPropagation();
}}
style={{ display: "flex" }}
className={docRef && "row-hover-iconButton"}
disabled={!docRef}
>
<UploadIcon />
</IconButton>

View File

@@ -107,7 +107,7 @@ function ControlledImageUploader({
if (docRef && imageFile) {
upload({
docRef: docRef as any,
docRef: docRef! as any,
fieldName: column.key,
files: [imageFile],
previousValue: value ?? [],

View File

@@ -90,6 +90,7 @@ export default function Image_({
value,
onSubmit,
disabled,
docRef,
}: IHeavyCellProps) {
const confirm = useSetAtom(confirmDialogAtom, globalScope);
const updateField = useSetAtom(updateFieldAtom, tableScope);
@@ -106,13 +107,13 @@ export default function Image_({
if (imageFile) {
upload({
docRef: row.ref,
docRef: docRef! as any,
fieldName: column.key,
files: [imageFile],
previousValue: value,
onComplete: (newValue) => {
updateField({
path: row._rowy_ref.path,
path: docRef.path,
fieldName: column.key,
value: newValue,
});
@@ -270,12 +271,13 @@ export default function Image_({
!disabled && (
<IconButton
size="small"
className="row-hover-iconButton"
onClick={(e) => {
dropzoneProps.onClick!(e);
e.stopPropagation();
}}
style={{ display: "flex" }}
className={docRef && "row-hover-iconButton"}
disabled={!docRef}
>
<AddIcon />
</IconButton>