-
Notifications
You must be signed in to change notification settings - Fork 278
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
[sitecore-jss-react] [sitecore-jss-nextjs] Default Placeholder Content for empty fields in editMode metadata #1831
Changes from all commits
de2dc7c
e01330f
c0d4681
32bfea9
be9b0be
2fd41cc
801ebf6
237d1bd
c1164a7
79a0b4e
085e09b
aca9f14
881362c
54f0282
abbb0d7
a1edea7
6a94a33
052fc3b
74960b3
48a2af2
62bf073
2a05d7c
534a0f2
b669ab5
f18852a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,15 +30,19 @@ export const Link = forwardRef<HTMLAnchorElement, LinkProps>( | |
|
||
if ( | ||
!field || | ||
(!(field as LinkFieldValue).editable && !field.value && !(field as LinkFieldValue).href) | ||
(!(field as LinkFieldValue).editable && | ||
!field.value && | ||
!(field as LinkFieldValue).href && | ||
!field.metadata) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to add a metadata check in other components? For example Next.js RichText component, it has a similar check. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where is the similar check for nextjs RichText? (link does not show it). I think we don't need it for RichText - we don't have similar 'return null' as it is in here in Link. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. i added it |
||
) { | ||
return null; | ||
} | ||
|
||
const value = ((field as LinkFieldValue).href | ||
? field | ||
: (field as LinkField).value) as LinkFieldValue; | ||
const { href, querystring, anchor } = value; | ||
// fallback to {} if value is undefined; could happen if field is LinkFieldValue, href is empty in metadata mode | ||
const { href, querystring, anchor } = value || {}; | ||
illiakovalenko marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const isEditing = | ||
editable && ((field as LinkFieldValue).editable || (field as LinkFieldValue).metadata); | ||
|
yavorsk marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add a test case to cover: when field is the value itself (GenericFIeldValue) type (applicable for rest of unit tests below)