sanity icon indicating copy to clipboard operation
sanity copied to clipboard

refactor(structure): skip lazy-loading of default pane types

Open rexxars opened this issue 1 month ago • 3 comments

Edit: This seems to have broken production builds, which now gets

Error: Pane: missing context value

Unclear to me at this time why this happens. Circular imports?

Description

We're currently lazy-loading the different pane types that can appear in structure. The benefit of this is extremely slim, as 99% of all Sanity studios will include both the list, document list and document pane types - and the remaining UserComponent pane is fairly slim.

Additionally, this lazy loading has caused a few code splitting/chunk issues in the past. It also causes an extra delay while loading the module. If we know we're going to need it in most cases, I feel it's better to load it up-front.

This PR removes the lazy loading. I also took the liberty of de-barreling a few of the subfolders here, since we're moving in that direction generally. Also explicitly listed the things that are exported from structure/panes, since I'd prefer us not to blindly export things.

There is a new list in the test studio, "Structure pane types", which can be used to test all the different pane types.

What to review

  • Do all the pane types still load as expected? Then we should be good to go 👍
  • Are there drawbacks of this refactor that has not been considered?

Testing

I did not add any new tests, as this is baseline functionality that is tested on pretty much every page load.

Notes for release

None. Internal change.

rexxars avatar May 24 '24 22:05 rexxars