Skip to content

Commit 2e47715

Browse files
authored
fix(core): fixes an issue with pasting in conditional readonly field (#7564)
1 parent df0e18a commit 2e47715

File tree

3 files changed

+187
-3
lines changed

3 files changed

+187
-3
lines changed

packages/sanity/src/core/studio/copyPaste/CopyPasteProvider.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
set,
1818
setIfMissing,
1919
useClient,
20+
useCurrentUser,
2021
useSchema,
2122
useTranslation,
2223
} from '../..'
@@ -41,6 +42,7 @@ export const CopyPasteProvider: React.FC<{
4142
const toast = useToast()
4243
const telemetry = useTelemetry()
4344
const schema = useSchema()
45+
const currentUser = useCurrentUser()
4446

4547
const {t} = useTranslation('copy-paste')
4648
const client = useClient(DEFAULT_STUDIO_CLIENT_OPTIONS)
@@ -245,6 +247,7 @@ export const CopyPasteProvider: React.FC<{
245247
// needs the document and absolute path to the field
246248
targetRootPath: targetPath,
247249
targetRootValue: value,
250+
currentUser,
248251
options: {
249252
validateAssets: true,
250253
validateReferences: true,
@@ -356,7 +359,7 @@ export const CopyPasteProvider: React.FC<{
356359
// TODO: missing case with multiple updated items?
357360
}
358361
},
359-
[documentMeta, schema, telemetry, toast, client, t],
362+
[documentMeta, schema, currentUser, client, telemetry, toast, t],
360363
)
361364

362365
const contextValue = useMemo(

0 commit comments

Comments
 (0)