🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Bug in opening Sanity Studio in different windows/tabs after v3 upgrade

16 replies
Last updated: Feb 21, 2023
I have updated to sanity 3.4.0 and now I am getting this error along with 2 other errors that are very similar.
[ERROR] No matching export in "node_modules/rxjs/_esm5/index.js" for import "tap"

node_modules/@sanity/portable-text-editor/lib/index.esm.js
:5:16: 5 │ import { defer, tap, switchMap, of, EMPTY, concatMap, Subject } from 'rxjs';
Feb 19, 2023, 10:21 PM
sounds like a conflict in your dep lock file. delete it and node_modules and run install again.
Feb 19, 2023, 10:25 PM
I tried that and it didn't work. I was able to fix it by changing the import in the node_modules/@sanity/portable-text-editor from rxjs to rxjs/operators for tap, switchMap, and concatMap. Not sure why that isn't changed with an update, im sure if I built it as a new project it would probably work.
Feb 19, 2023, 10:37 PM
def. I found that the sanity upgrade story from v2 to v3 had A LOT of issues. its probably better to install from scratch and move your config, schema, components over.
Feb 19, 2023, 10:39 PM
Yea i'm thinking about doing that as well. I just deployed it and now I'm having reference issues.
Feb 19, 2023, 10:39 PM
I'm getting this but I didn't change anything in my schemas
Feb 19, 2023, 10:41 PM
what does your schema look like for this list.
Feb 19, 2023, 10:46 PM
{
name: 'subCategories',
type: 'array',
title: 'List of sub categories',
of: [
{
name: 'subCategory',
type: 'reference',
title: 'Sub Category',
to: [{type: 'subCategories'}],
},
],
},
Feb 19, 2023, 10:51 PM
do you mean to pass
type: subCategory
instead of a reference to itself?
Feb 19, 2023, 10:57 PM
No the
name
of the subCategory document is subCategories so that is correct. I haven't changed anything and it was working before. The only thing I did different was I pulled the repo from github to another computer and deployed from the other computer, but I didn't make any changes to the the schemas.
Feb 19, 2023, 10:59 PM
I'm thinking it has something to do with that
Feb 19, 2023, 10:59 PM
right but the name of the field you are making also has the same name. I can imagine its doing a circular look because the names are the same.
Feb 19, 2023, 10:59 PM
defineField({
      title: "Sub Categories",
      name: "subCategories", // either change this 
      type: "array",
      of: [
        {
          type: "reference",
          to: {type: "subCategories"}, // or change this 
        },
      ],
    }),
Feb 19, 2023, 11:00 PM
This would be invalid anyway so thats prolly why its failing now as its more strict or has better validation.
Feb 19, 2023, 11:02 PM
you should use the new defineField and defineType functions too. it will give you validation errors when working with the schema.
import {defineField, defineType} _from_ "sanity"
Feb 19, 2023, 11:05 PM
Sorry to take you down this path man. I found the problem. I pushed an old file to github and messed everything up. The suggestions from defineField was a good one though and I will update my code to use this. Thanks
Feb 19, 2023, 11:25 PM
Feb 21, 2023, 10:11 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?