Alex Carliner
Alex Carliner

Reputation: 1

No updates applied in SANITY Server (Production Preview Mode)

UPDATING 1 PROPERTY IN A SCHEMATYPE

By adding only one defineField:

defineField({
      name: 'surname',
      title: 'Surname',
      type: 'string',
    }),

within one already created document named "author.ts", well rethrieved by "index.ts" file to export whole schema, the SANITY Server Side STUDIO doesn't apply this unique modification.

//author.ts
import {defineField, defineType} from 'sanity'

export default defineType({
  name: 'author',
  title: 'Author',
  type: 'document',
  fields: [
    defineField({
      name: 'name',
      title: 'Name',
      type: 'string',
    }),
    defineField({
      name: 'surname',
      title: 'Surname',
      type: 'string',
    }),
    defineField({
      name: 'biography',
      title: 'Biography',
      type: 'blockContent',
    }),
    defineField({
      name: 'slug',
      title: 'Slug',
      type: 'slug',
      options: {
        source: 'name',
        maxLength: 96,
      },
    }),
    defineField({
      name: 'job',
      title: 'Job',
      type: 'string',
    }),
    defineField({
      name: 'image',
      title: 'Image',
      type: 'image',
      options: {
        hotspot: true,
      },
    }),
  ],
  preview: {
    select: {
      title: 'name',
      media: 'image',
    },
  },
})

I encounter the problem of non-automated push updates of SchemaTypes state, in the SANITY studio visual mode rendering(production preview mode).

NO MODIFICATIONS APPLIED IN SANITY(production preview mode)

SANITY Production preview mode

In the past modifications applied on SANITY Project SchemaTypes, were well taking into account in the preview mode production side. However, after the disappearance of a simple question on server deployment process, modifications suddenly stopped (SANITY Production Preview Mode).

SANITY Developer preview mode

Knowingly when I launch the command:

npm run dev | sanity dev

The modification made is well applied (SANITY Developer Preview mode).

ATTEMPT 1 | "CTRL + C" -> "NPM RUN START"

I tried at several times to relaunch the SANITY Server. When modifications stopped to be shared on production mode, the fundamental difference which appeared was the disappearance of the following question:

"Would you want to deploy a new local server? Y/N"

It seems by default SANITY CMS log me in on the previous server statement. But don't know how to disconnect manually completely.

ATTEMPT 1.1 | LOG OUT SANITY CMS

I tried even to launch the command

npm run logout | sanity logout

without any success.

Rendering me, "you have no credentials login".

ATTEMPT 2 | "export const revalidate = 60;"

I found on SANITY forum the implementation of such a line but don't know exactly on which file to apply this.

Is it on index.js?

Upvotes: 0

Views: 82

Answers (1)

Alex Carliner
Alex Carliner

Reputation: 1

After several times of search I finally found a solution.

PUSH MANUALLY SCHEMATYPES UPDATES ON SANITY STUDIO (Production Preview Mode)

To manually apply latest updates on SANITY Studio Production mode (when you find that no update has been performed when you try to run the following command):

npm run start | sanity start

if it doesn't apply anymore automatically as shared in their official tutorial documentation, here is the simplest answer.

you need to run the following command:

npm run build | sanity build

This will rebuild the architecture datas SchemaTypes latest components into the production mode overview, in a manual non-automated operation.

Then, launch again:

npm run start | sanity start

Upvotes: 0

Related Questions