Bug in opening Sanity Studio in different windows/tabs after v3 upgrade
16 replies
Last updated: Feb 21, 2023
K
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';
[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
P
sounds like a conflict in your dep lock file. delete it and node_modules and run install again.
Feb 19, 2023, 10:25 PM
K
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
P
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
K
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
K
I'm getting this but I didn't change anything in my schemas
Feb 19, 2023, 10:41 PM
P
what does your schema look like for this list.
Feb 19, 2023, 10:46 PM
K
{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
P
do you mean to pass
type: subCategoryinstead of a reference to itself?
Feb 19, 2023, 10:57 PM
K
No the
nameof 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
K
I'm thinking it has something to do with that
Feb 19, 2023, 10:59 PM
P
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
P
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
P
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
P
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
K
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
E
Check my answer here for a possible solution to the rxjs error: https://sanity-io-land.slack.com/archives/C9Z7RC3V1/p1677016448020399?thread_ts=1676530520.281159&cid=C9Z7RC3V1
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.