Skip to content

Commit

Permalink
fix(form/inputs): fix component fallback behaviour
Browse files Browse the repository at this point in the history
This was a regression made in f1152f7
  • Loading branch information
skogsmaskin committed Dec 22, 2022
1 parent 24805ae commit e892c62
Showing 1 changed file with 4 additions and 2 deletions.
@@ -1,12 +1,14 @@
import {Text} from '@sanity/ui'
import {BlockStyleRenderProps} from '@sanity/portable-text-editor'
import React, {useCallback, useMemo} from 'react'
import {TEXT_STYLES} from './textStyles'
import {Normal as FallbackComponent, TEXT_STYLES} from './textStyles'

export const Style = (props: BlockStyleRenderProps) => {
const {block, focused, children, selected, type, value} = props
const DefaultComponent = useMemo(
() => (block.style && TEXT_STYLES[block.style] ? TEXT_STYLES[block.style] : TEXT_STYLES[0]),
() =>
(block.style && TEXT_STYLES[block.style] ? TEXT_STYLES[block.style] : TEXT_STYLES[0]) ||
FallbackComponent,
[block.style]
)

Expand Down

1 comment on commit e892c62

@vercel
Copy link

@vercel vercel bot commented on e892c62 Dec 22, 2022

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:

test-studio – ./

test-studio-git-next.sanity.build
test-studio.sanity.build

Please sign in to comment.