[fix] Increment cache version after object/field/relation update (#5316)
Fixes #5276. Updates were not triggering a cache version incrementation because they do not trigger migrations while that is where the caching version logic was. We have decided to move the cache incrementation logic to the services.
This commit is contained in:
@ -80,7 +80,7 @@ export const UPDATE_ONE_FIELD_METADATA_ITEM = gql`
|
||||
export const UPDATE_ONE_OBJECT_METADATA_ITEM = gql`
|
||||
mutation UpdateOneObjectMetadataItem(
|
||||
$idToUpdate: UUID!
|
||||
$updatePayload: UpdateObjectInput!
|
||||
$updatePayload: UpdateObjectPayload!
|
||||
) {
|
||||
updateOneObject(input: { id: $idToUpdate, update: $updatePayload }) {
|
||||
id
|
||||
|
||||
@ -3,7 +3,7 @@ import { gql } from '@apollo/client';
|
||||
export const query = gql`
|
||||
mutation UpdateOneObjectMetadataItem(
|
||||
$idToUpdate: UUID!
|
||||
$updatePayload: UpdateObjectInput!
|
||||
$updatePayload: UpdateObjectPayload!
|
||||
) {
|
||||
updateOneObject(input: { id: $idToUpdate, update: $updatePayload }) {
|
||||
id
|
||||
|
||||
@ -2,7 +2,7 @@ import { useMutation } from '@apollo/client';
|
||||
import { getOperationName } from '@apollo/client/utilities';
|
||||
|
||||
import {
|
||||
UpdateObjectInput,
|
||||
UpdateOneObjectInput,
|
||||
UpdateOneObjectMetadataItemMutation,
|
||||
UpdateOneObjectMetadataItemMutationVariables,
|
||||
} from '~/generated-metadata/graphql';
|
||||
@ -27,8 +27,8 @@ export const useUpdateOneObjectMetadataItem = () => {
|
||||
idToUpdate,
|
||||
updatePayload,
|
||||
}: {
|
||||
idToUpdate: UpdateOneObjectMetadataItemMutationVariables['idToUpdate'];
|
||||
updatePayload: UpdateObjectInput;
|
||||
idToUpdate: UpdateOneObjectInput['id'];
|
||||
updatePayload: UpdateOneObjectInput['update'];
|
||||
}) => {
|
||||
return await mutate({
|
||||
variables: {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { SafeParseSuccess } from 'zod';
|
||||
|
||||
import { UpdateObjectInput } from '~/generated-metadata/graphql';
|
||||
import { UpdateObjectPayload } from '~/generated-metadata/graphql';
|
||||
|
||||
import { settingsUpdateObjectInputSchema } from '../settingsUpdateObjectInputSchema';
|
||||
|
||||
@ -20,7 +20,7 @@ describe('settingsUpdateObjectInputSchema', () => {
|
||||
|
||||
// Then
|
||||
expect(result.success).toBe(true);
|
||||
expect((result as SafeParseSuccess<UpdateObjectInput>).data).toEqual({
|
||||
expect((result as SafeParseSuccess<UpdateObjectPayload>).data).toEqual({
|
||||
description: validInput.description,
|
||||
icon: validInput.icon,
|
||||
labelIdentifierFieldMetadataId: validInput.labelIdentifierFieldMetadataId,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { objectMetadataItemSchema } from '@/object-metadata/validation-schemas/objectMetadataItemSchema';
|
||||
import { UpdateObjectInput } from '~/generated-metadata/graphql';
|
||||
import { UpdateObjectPayload } from '~/generated-metadata/graphql';
|
||||
import { formatMetadataLabelToMetadataNameOrThrows } from '~/pages/settings/data-model/utils/format-metadata-label-to-name.util';
|
||||
|
||||
export const settingsUpdateObjectInputSchema = objectMetadataItemSchema
|
||||
@ -13,7 +13,7 @@ export const settingsUpdateObjectInputSchema = objectMetadataItemSchema
|
||||
labelSingular: true,
|
||||
})
|
||||
.partial()
|
||||
.transform<UpdateObjectInput>((value) => ({
|
||||
.transform<UpdateObjectPayload>((value) => ({
|
||||
...value,
|
||||
nameSingular: value.labelSingular
|
||||
? formatMetadataLabelToMetadataNameOrThrows(value.labelSingular)
|
||||
|
||||
Reference in New Issue
Block a user