fix!: exports getSiblingData, getDataByPath, and reduceFieldsToValues from payload (#7070)
## Description
Exports `getSiblingData`, `getDataByPath`, `reduceFieldsToValues`, and
`unflatten` from `payload`. These utilities were previously accessible
using direct import paths from `@payloadcms/ui`—but this is no longer
advised since moving to a pre-bundled UI library pattern. Instead of
simply exporting these from the `@payloadcms/ui` package, these exports
have been moved to Payload itself to provision for use outside of React
environments.
This is considered a breaking change. If you were previously importing
any of these utilities, the imports paths have changed as follows:
Old:
```ts
import { getSiblingData, getDataByPath, reduceFieldsToValues } from '@payloadcms/ui/forms/Form'
import { unflatten } from '@payloadcms/ui/utilities'
```
New:
```ts
import { getSiblingData, getDataByPath, reduceFieldsToValues, unflatten } from 'payload/shared'
```
The `is-buffer` dependency was also removed in this PR.
- [x] I have read and understand the
[CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md)
document in this repository.
## Type of change
- [x] Bug fix (non-breaking change which fixes an issue)
## Checklist:
- [x] Existing test suite passes locally with my changes
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
import type { FormState } from 'payload'
|
||||
|
||||
import { useConfig, useDrawerSlug, useFieldProps, useModal, useTranslation } from '@payloadcms/ui'
|
||||
import { getFormState, reduceFieldsToValues } from '@payloadcms/ui/shared'
|
||||
import { getFormState } from '@payloadcms/ui/shared'
|
||||
import { reduceFieldsToValues } from 'payload/shared'
|
||||
import React, { Fragment, useState } from 'react'
|
||||
import { Editor, Range, Transforms } from 'slate'
|
||||
import { ReactEditor, useSlate } from 'slate-react'
|
||||
|
||||
@@ -14,8 +14,8 @@ import {
|
||||
useModal,
|
||||
useTranslation,
|
||||
} from '@payloadcms/ui'
|
||||
import { getFormState, reduceFieldsToValues } from '@payloadcms/ui/shared'
|
||||
import { deepCopyObject } from 'payload/shared'
|
||||
import { getFormState } from '@payloadcms/ui/shared'
|
||||
import { deepCopyObject, reduceFieldsToValues } from 'payload/shared'
|
||||
import React, { useCallback, useEffect, useState } from 'react'
|
||||
import { Editor, Node, Transforms } from 'slate'
|
||||
import { ReactEditor, useSlate } from 'slate-react'
|
||||
|
||||
Reference in New Issue
Block a user