Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: testing Million Lint #7868

Draft
wants to merge 17 commits into
base: next
Choose a base branch
from
4 changes: 2 additions & 2 deletions dev/page-building-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
},
"dependencies": {
"@sanity/vision": "workspace:*",
"babel-plugin-react-compiler": "19.0.0-beta-0dec889-20241115",
"babel-plugin-react-compiler": "0.0.0-experimental-dc8bd44-20241121",
"react": "^18.2.0",
"react-compiler-runtime": "19.0.0-beta-0dec889-20241115",
"react-compiler-runtime": "0.0.0-experimental-dc8bd44-20241121",
"react-dom": "^18.2.0",
"react-icons": "^5.2.1",
"sanity": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions dev/starter-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"start": "../.bin/sanity start --port 3337"
},
"dependencies": {
"babel-plugin-react-compiler": "19.0.0-beta-0dec889-20241115",
"babel-plugin-react-compiler": "0.0.0-experimental-dc8bd44-20241121",
"react": "^18.3.1",
"react-compiler-runtime": "19.0.0-beta-0dec889-20241115",
"react-compiler-runtime": "0.0.0-experimental-dc8bd44-20241121",
"react-dom": "^18.3.1",
"sanity": "workspace:*",
"styled-components": "^6.1.0"
Expand Down
4 changes: 2 additions & 2 deletions dev/studio-e2e-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"@sanity/icons": "^3.4.0",
"@sanity/ui": "^2.8.24",
"@sanity/vision": "3.64.3",
"babel-plugin-react-compiler": "19.0.0-beta-0dec889-20241115",
"babel-plugin-react-compiler": "0.0.0-experimental-dc8bd44-20241121",
"react": "^18.3.1",
"react-compiler-runtime": "19.0.0-beta-0dec889-20241115",
"react-compiler-runtime": "0.0.0-experimental-dc8bd44-20241121",
"react-dom": "^18.3.1",
"sanity": "workspace:*",
"sanity-plugin-media": "^2.3.1",
Expand Down
2 changes: 1 addition & 1 deletion dev/test-next-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@sanity/vision": "workspace:*",
"babel-plugin-react-compiler": "19.0.0-beta-0dec889-20241115",
"babel-plugin-react-compiler": "0.0.0-experimental-dc8bd44-20241121",
"next": "15.0.3",
"react": "rc",
"react-dom": "rc",
Expand Down
1 change: 1 addition & 0 deletions dev/test-studio/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@

.env.*
!.env.example
.million
5 changes: 3 additions & 2 deletions dev/test-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"workshop:dev": "node -r esbuild-register scripts/workshop/dev.ts"
},
"dependencies": {
"@million/lint": "^1.0.12",
"@portabletext/editor": "^1.10.2",
"@portabletext/react": "^3.0.0",
"@sanity/assist": "^3.0.2",
Expand Down Expand Up @@ -51,7 +52,7 @@
"lodash": "^4.17.21",
"qs": "^6.10.2",
"react": "^18.3.1",
"react-compiler-runtime": "19.0.0-beta-0dec889-20241115",
"react-compiler-runtime": "0.0.0-experimental-dc8bd44-20241121",
"react-dom": "^18.3.1",
"react-refractor": "^2.1.6",
"refractor": "^3.6.0",
Expand All @@ -63,7 +64,7 @@
"styled-components": "^6.1.11"
},
"devDependencies": {
"babel-plugin-react-compiler": "19.0.0-beta-0dec889-20241115",
"babel-plugin-react-compiler": "0.0.0-experimental-dc8bd44-20241121",
"chokidar": "^3.6.0",
"vite": "^4.5.5"
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.36.1",
"eslint-plugin-react-compiler": "19.0.0-beta-0dec889-20241115",
"eslint-plugin-react-compiler": "0.0.0-experimental-dc8bd44-20241121",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-tsdoc": "^0.3.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/@sanity/vision/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"json5": "^2.2.3",
"lodash": "^4.17.21",
"quick-lru": "^5.1.1",
"react-compiler-runtime": "19.0.0-beta-0dec889-20241115"
"react-compiler-runtime": "0.0.0-experimental-dc8bd44-20241121"
},
"devDependencies": {
"@repo/package.config": "workspace:*",
Expand All @@ -85,7 +85,7 @@
"@sanity/types": "workspace:*",
"@sanity/util": "workspace:*",
"@types/lodash": "^4.17.7",
"babel-plugin-react-compiler": "19.0.0-beta-0dec889-20241115",
"babel-plugin-react-compiler": "0.0.0-experimental-dc8bd44-20241121",
"react": "^18.3.1",
"sanity": "workspace:*",
"styled-components": "^6.1.13"
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity/package.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default defineConfig({
rules: {
...baseConfig.extract.rules,
'ae-incompatible-release-tags': 'error',
'ae-missing-release-tag': 'error',
'ae-missing-release-tag': 'warn',
},
},

Expand Down
4 changes: 2 additions & 2 deletions packages/sanity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
"pretty-ms": "^7.0.1",
"quick-lru": "^5.1.1",
"raf": "^3.4.1",
"react-compiler-runtime": "19.0.0-beta-0dec889-20241115",
"react-compiler-runtime": "0.0.0-experimental-dc8bd44-20241121",
"react-copy-to-clipboard": "^5.0.4",
"react-fast-compare": "^3.2.0",
"react-focus-lock": "^2.8.1",
Expand Down Expand Up @@ -300,7 +300,7 @@
"@types/tar-fs": "^2.0.1",
"@vitejs/plugin-react": "^4.3.3",
"@vvo/tzdb": "6.137.0",
"babel-plugin-react-compiler": "19.0.0-beta-0dec889-20241115",
"babel-plugin-react-compiler": "0.0.0-experimental-dc8bd44-20241121",
"blob-polyfill": "^9.0.20240710",
"date-fns-tz": "2.0.1",
"react": "^18.3.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export interface ChangeIndicatorProps {
}

/** @internal */
export function ChangeIndicator(
export const ChangeIndicator = memo(function ChangeIndicator(
props: ChangeIndicatorProps & Omit<HTMLProps<HTMLDivElement>, 'as'>,
) {
const {children, hasFocus, isChanged, path, withHoverEffect, ...restProps} = props
Expand All @@ -114,4 +114,4 @@ export function ChangeIndicator(
{children}
</ChangeBarWrapper>
)
}
})
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {type ReactNode, useCallback, useMemo, useState} from 'react'
import {memo, type ReactNode, useCallback, useMemo, useState} from 'react'
import {CommentsAuthoringPathContext} from 'sanity/_singletons'

import {type CommentsAuthoringPathContextValue} from './types'
Expand All @@ -17,7 +17,9 @@ interface CommentsAuthoringPathProviderProps {
* the component re-renders, for example, when the form is temporarily set to `readOnly`
* while reconnecting.
*/
export function CommentsAuthoringPathProvider(props: CommentsAuthoringPathProviderProps) {
export const CommentsAuthoringPathProvider = memo(function CommentsAuthoringPathProvider(
props: CommentsAuthoringPathProviderProps,
) {
const {children} = props
const [authoringPath, setAuthoringPath] = useState<string | null>(null)

Expand All @@ -38,4 +40,4 @@ export function CommentsAuthoringPathProvider(props: CommentsAuthoringPathProvid
{children}
</CommentsAuthoringPathContext.Provider>
)
}
})
44 changes: 26 additions & 18 deletions packages/sanity/src/core/comments/plugin/field/CommentsField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export function CommentsField(props: FieldProps) {

return <CommentFieldInner {...props} mode={mode} />
}
CommentsField.displayName = 'CommentsField'

const HighlightDiv = styled(motion.div)(({theme}) => {
const {radius, space, color} = theme.sanity
Expand Down Expand Up @@ -108,7 +109,7 @@ function CommentFieldInner(
})

const fieldTitle = useMemo(() => getSchemaTypeTitle(props.schemaType), [props.schemaType])
const stringPath = useMemo(() => PathUtils.toString(props.path), [props.path])
const stringPath = PathUtils.toString(props.path)

// Use the cached value if it exists as the initial value
const cachedValue = messageCache.get(stringPath) || null
Expand Down Expand Up @@ -278,9 +279,9 @@ function CommentFieldInner(
[stringPath],
)

const internalComments: FieldProps['__internal_comments'] = useMemo(
() => ({
button: currentUser && (
const button = useMemo(
() =>
currentUser && (
<CommentsFieldButton
count={Number(count)}
currentUser={currentUser}
Expand All @@ -296,33 +297,39 @@ function CommentFieldInner(
value={value}
/>
),
hasComments,
isAddingComment: isOpen,
}),
[
currentUser,
count,
currentUser,
fieldTitle,
isCreatingDataset,
mentionOptions,
handleOnChange,
handleClick,
handleClose,
handleCommentAdd,
resetMessageValue,
handleOnChange,
isCreatingDataset,
isOpen,
mentionOptions,
resetMessageValue,
value,
hasComments,
],
)

return (
<FieldStack {...applyCommentsFieldAttr(PathUtils.toString(props.path))} ref={rootRef}>
{props.renderDefault({
const content = useMemo(
() =>
props.renderDefault({
...props,
// eslint-disable-next-line camelcase
__internal_comments: internalComments,
})}
__internal_comments: {
button,
hasComments,
isAddingComment: isOpen,
},
}),
[button, hasComments, isOpen, props],
)

return (
<FieldStack {...applyCommentsFieldAttr(PathUtils.toString(props.path))} ref={rootRef}>
{content}

<AnimatePresence>
{isSelected && !isInlineCommentThread && (
Expand All @@ -337,3 +344,4 @@ function CommentFieldInner(
</FieldStack>
)
}
CommentFieldInner.displayName = 'CommentFieldInner'
Loading
Loading