feat: add Text field preview in settings (#2389)

Closes #2325
This commit is contained in:
Thaïs
2023-11-09 08:25:46 +01:00
committed by GitHub
parent 4efbe4d798
commit 1f5492b4a7
23 changed files with 461 additions and 540 deletions
@@ -35,8 +35,11 @@ import { isFieldURLV2Value } from '../types/guards/isFieldURLV2Value';
import { isFieldURLValue } from '../types/guards/isFieldURLValue';
export const usePersistField = () => {
const { entityId, fieldDefinition, useUpdateEntityMutation } =
useContext(FieldContext);
const {
entityId,
fieldDefinition,
useUpdateEntityMutation = () => [],
} = useContext(FieldContext);
const [updateEntity] = useUpdateEntityMutation();
@@ -102,7 +105,7 @@ export const usePersistField = () => {
valueToPersist,
);
updateEntity({
updateEntity?.({
variables: {
where: { id: entityId },
data: {
@@ -120,7 +123,7 @@ export const usePersistField = () => {
valueToPersist,
);
updateEntity({
updateEntity?.({
variables: {
where: { id: entityId },
data: {
@@ -145,7 +148,7 @@ export const usePersistField = () => {
valueToPersist.secondValue,
);
updateEntity({
updateEntity?.({
variables: {
where: { id: entityId },
data: {
@@ -176,7 +179,7 @@ export const usePersistField = () => {
valueToPersist,
);
updateEntity({
updateEntity?.({
variables: {
where: { id: entityId },
data: {
@@ -6,8 +6,11 @@ import { entityFieldsFamilySelector } from '../states/selectors/entityFieldsFami
import { isFieldBoolean } from '../types/guards/isFieldBoolean';
export const useToggleEditOnlyInput = () => {
const { entityId, fieldDefinition, useUpdateEntityMutation } =
useContext(FieldContext);
const {
entityId,
fieldDefinition,
useUpdateEntityMutation = () => [],
} = useContext(FieldContext);
const [updateEntity] = useUpdateEntityMutation();
@@ -27,7 +30,7 @@ export const useToggleEditOnlyInput = () => {
valueToPersist,
);
updateEntity({
updateEntity?.({
variables: {
where: { id: entityId },
data: {