Error with @sanity/desk-tool/structure-builder resolved by using S.list instead of importing directly
7 replies
Last updated: Oct 13, 2021
T
Hello! I keep getting this sort of error and I cannot understand what might cause it. Is this a versioning issue? All packages are up-to-date (as of time of typing this)
I cannot enter det desk, but Vision plugin works.
I cannot enter det desk, but Vision plugin works.
TypeError: (0 , _structureBuilder.list) is not a function at _default (/static/js/app.bundle.js:168275:49) at serializeStructure (/static/js/app.bundle.js:382416:31) at <http://localhost:3333/static/js/app.bundle.js:167462:65> at Observable._subscribe (/static/js/app.bundle.js:96047:21) at Observable._trySubscribe (/static/js/app.bundle.js:2986:25) at Observable.subscribe (/static/js/app.bundle.js:2972:22) at DistinctUntilChangedOperator.call (/static/js/app.bundle.js:124910:23) at Observable.subscribe (/static/js/app.bundle.js:2967:31) at MapOperator.call (/static/js/app.bundle.js:27473:23) at Observable.subscribe (/static/js/app.bundle.js:2967:31)
Oct 12, 2021, 9:30 PM
T
I have not last it worked, but I did try to comment out more and more of it to see if anything could help.
I did notice that when I changed imports from
to
This works
đ
I did notice that when I changed imports from
import S, { list, listItem, editor, documentTypeList } from '@sanity/desk-tool/structure-builder';
import S from '@sanity/desk-tool/structure-builder'; // Then instead of importing directly, deconstruct from S const { list, listItem, editor, documentTypeList } = S;
đ
Oct 12, 2021, 9:46 PM
Ah, interesting. Did you notice if this happened after upgrading your Studio or was it totally out of the blue?
Oct 12, 2021, 9:47 PM
T
So I guess the fix or pattern to avoid it is to use the structure builder parts on this form:
Weâve used it like above for a while so I canât really tell what weâve done differently, and I have had my focus on other parts of our project so I am not entirely sure when this bug appeared. Itâs been like that on my localhost for at least a week, perhaps more. But, for the same period I know it worked for my colleagues so thatâs what was a bit baffling
đ
The last time something similar happened I deleted my local version and cloned the repository and it worked again, but I cant promise you that it was the exact same issue.
Sorry I donât have more details about which versions we were on. The reason I upgraded now was an attempt to resolve the issue on mye end, so it definitely wasnât the last version change that triggered it.
S.listetc. instead of importing them.
Weâve used it like above for a while so I canât really tell what weâve done differently, and I have had my focus on other parts of our project so I am not entirely sure when this bug appeared. Itâs been like that on my localhost for at least a week, perhaps more. But, for the same period I know it worked for my colleagues so thatâs what was a bit baffling
đ
The last time something similar happened I deleted my local version and cloned the repository and it worked again, but I cant promise you that it was the exact same issue.
Sorry I donât have more details about which versions we were on. The reason I upgraded now was an attempt to resolve the issue on mye end, so it definitely wasnât the last version change that triggered it.
Oct 12, 2021, 9:51 PM
T
So I guess the fix or pattern to avoid it is to use the structure builder parts on this form:
Weâve used it like above for a while so I canât really tell what weâve done differently, and I have had my focus on other parts of our project so I am not entirely sure when this bug appeared. Itâs been like that on my localhost for at least a week, perhaps more. But, for the same period I know it worked for my colleagues so thatâs what was a bit baffling
đ
The last time something similar happened I deleted my local version and cloned the repository and it worked again, but I cant promise you that it was the exact same issue.
Sorry I donât have more details about which versions we were on. The reason I upgraded now was an attempt to resolve the issue on mye end, so it definitely wasnât the last version change that triggered it.
S.listetc. instead of importing them.
Weâve used it like above for a while so I canât really tell what weâve done differently, and I have had my focus on other parts of our project so I am not entirely sure when this bug appeared. Itâs been like that on my localhost for at least a week, perhaps more. But, for the same period I know it worked for my colleagues so thatâs what was a bit baffling
đ
The last time something similar happened I deleted my local version and cloned the repository and it worked again, but I cant promise you that it was the exact same issue.
Sorry I donât have more details about which versions we were on. The reason I upgraded now was an attempt to resolve the issue on mye end, so it definitely wasnât the last version change that triggered it.
Oct 12, 2021, 9:51 PM
T
Thanks for you quick attention, though đ
Oct 12, 2021, 9:53 PM
Happy to help! I'm curious, though, where did you see that pattern that you were originally using? Was it something you picked up from our docs?
Oct 12, 2021, 9:54 PM
T
Weâve had id like that since early 2019, so TBH I donât recall from where we found that pattern. Itâs not unlikely that it was something we âcreativelyâ did on our own đ
Oct 13, 2021, 8:59 AM
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.