Skip to content

Commit

Permalink
fix: use new ContentSourceMapParsedPathKeyedSegment format
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Nov 7, 2023
1 parent 00b2954 commit 20b3186
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 37 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dependencies": {
"@sanity/block-tools": "3.18.2-pink-lizard.172",
"@sanity/cli": "3.18.2-pink-lizard.172",
"@sanity/client": "6.8.0-pink-lizard.2",
"@sanity/client": "6.8.0-pink-lizard.3",
"@sanity/diff": "3.18.2-pink-lizard.172",
"@sanity/export": "3.18.2-pink-lizard.172",
"@sanity/import": "3.18.2-pink-lizard.172",
Expand Down
4 changes: 4 additions & 0 deletions packages/nuxt-loader/src/directive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ export type {
ContentSourceMapLiteralSource,
ContentSourceMapMapping,
ContentSourceMapMappings,
ContentSourceMapParsedPath,
ContentSourceMapParsedPathKeyedSegment,
ContentSourceMapPaths,
ContentSourceMapRemoteDocument,
ContentSourceMapSource,
ContentSourceMapUnknownSource,
ContentSourceMapValueMapping,
IndexTuple,
KeyedSegment,
Path,
PathSegment,
SanityDocument,
} from '@sanity/client/csm'
Expand Down
3 changes: 2 additions & 1 deletion packages/presentation/src/preview/PreviewLocationInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const PreviewLocationInput: FunctionComponent<{
onChange={handleChange}
onKeyDown={handleKeyDown}
padding={padding}
style={{ zIndex: 1 }}
prefix={
host && (
<Box
Expand All @@ -73,7 +74,7 @@ export const PreviewLocationInput: FunctionComponent<{
ref={inputRef}
space={padding}
suffix={
<Box style={{ lineHeight: 0 }}>
<Box style={{ lineHeight: 0, zIndex: -1 }}>
<Button
as="a"
fontSize={fontSize}
Expand Down
4 changes: 4 additions & 0 deletions packages/react-loader/src/jsx/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ export type {
ContentSourceMapLiteralSource,
ContentSourceMapMapping,
ContentSourceMapMappings,
ContentSourceMapParsedPath,
ContentSourceMapParsedPathKeyedSegment,
ContentSourceMapPaths,
ContentSourceMapRemoteDocument,
ContentSourceMapSource,
ContentSourceMapUnknownSource,
ContentSourceMapValueMapping,
IndexTuple,
KeyedSegment,
Path,
PathSegment,
SanityDocument,
} from '@sanity/client/csm'
Expand Down
6 changes: 3 additions & 3 deletions packages/visual-editing-helpers/src/csm/resolveSanityNode.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
type ContentSourceMap,
type ContentSourceMapParsedPath,
getPublishedId,
type PathSegment,
resolvedKeyedSourcePath,
resolveMapping,
simplifyPath,
Expand All @@ -13,8 +13,8 @@ import { SanityNodeContext } from './wrap/types'
export function resolveSanityNode(
context: SanityNodeContext,
csm: ContentSourceMap,
resultPath: PathSegment[],
keyedResultPath: PathSegment[],
resultPath: ContentSourceMapParsedPath,
keyedResultPath: ContentSourceMapParsedPath,
): SanityNode | undefined {
const { mapping, pathSuffix } = resolveMapping(resultPath, csm) || {}

Expand Down
8 changes: 4 additions & 4 deletions packages/visual-editing-helpers/src/csm/wrap/wrapData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import {
type ContentSourceMap,
type PathSegment,
type ContentSourceMapParsedPath,
simplifyPath,
} from '@sanity/client/csm'

Expand All @@ -16,8 +16,8 @@ export function wrapData<T>(
context: SanityNodeContext,
value: T,
sourceMap: ContentSourceMap | undefined,
resultPath: PathSegment[] = [],
keyedResultPath: PathSegment[] = [],
resultPath: ContentSourceMapParsedPath = [],
keyedResultPath: ContentSourceMapParsedPath = [],
): WrappedValue<T> {
if (value === undefined) {
return undefined as WrappedValue<T>
Expand All @@ -36,7 +36,7 @@ export function wrapData<T>(
resultPath.concat(idx),
keyedResultPath.concat(
isRecord(t) && '_key' in t && typeof t._key === 'string'
? { key: t._key, index: idx }
? { _key: t._key, _index: idx }
: idx,
),
),
Expand Down
61 changes: 33 additions & 28 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 comments on commit 20b3186

@vercel
Copy link

@vercel vercel bot commented on 20b3186 Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

visual-editing-remix – ./apps/remix

visual-editing-remix-git-main.sanity.build
visual-editing-remix.sanity.build

@vercel
Copy link

@vercel vercel bot commented on 20b3186 Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

visual-editing-page-builder-demo – ./apps/page-builder-demo

visual-editing-page-builder-demo-git-main.sanity.build
visual-editing-page-builder-demo.sanity.build

@vercel
Copy link

@vercel vercel bot commented on 20b3186 Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

visual-editing-studio – ./apps/studio

visual-editing-studio.sanity.build
visual-editing-studio-git-main.sanity.build

@vercel
Copy link

@vercel vercel bot commented on 20b3186 Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

visual-editing-svelte – ./apps/svelte

visual-editing-svelte-git-main.sanity.build
visual-editing-svelte.sanity.build

@vercel
Copy link

@vercel vercel bot commented on 20b3186 Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

visual-editing-nuxt – ./apps/nuxt

visual-editing-nuxt.sanity.build
visual-editing-nuxt-git-main.sanity.build

Please sign in to comment.