feat(dos-donts): add assets file and tests - #1383
Conversation
| @@ -1,7 +1,6 @@ | |||
| /* (c) Copyright Frontify Ltd., all rights reserved. */ | |||
|
|
|||
There was a problem hiding this comment.
The ref is already typed useRef<DosDontsAssetsRef>(null) and DosDontsAssetsRef.openUpload is non-optional, so this cast is redundant and actively harmful, it re-types the ref to a weaker shape where the method is optional. If openUpload is ever renamed/removed on the ref, TypeScript won't flag this call and the menu action silently no-ops at runtime. Call the typed ref directly.
Also for the other not only openUpload
ragi96
left a comment
There was a problem hiding this comment.
This 2 are important ones, If you don't get why we need to surpress it here, please reach out to me
a6be2f1 to
dd55c24
Compare
|
I’m not 100% sure if I resolved the drilling issue. Let me know how this attempt looks. |
@benfrontify can you kindly explain to me the drilling issue you are trying to solve and your attempt at solving it? By drilling issue I suspect it's about avoiding to send down a bunch of props through several components? |
|
| // eslint-disable-next-line @eslint-react/exhaustive-deps | ||
| }, [doneAll, uploadResults]); | ||
|
|
||
| const imageProps: ImageComponentProps = { |
There was a problem hiding this comment.
If you will use my {...props} suggestion, this can be removed and the component is simplified to:
<ImageComponent
onAssetChooseClick={onOpenAssetChooser}
onUploadClick={onUploadClick}
isUploadLoading={isUploadLoading}
isEditing={editing}
border={hasBorder ? `${borderWidth} ${borderStyle} ${toRgbaString(borderColor)}` : ''}
isDragging={Boolean(isDragging)}
{...props}
/>
There was a problem hiding this comment.
I am personally not a big fan of passing props
There was a problem hiding this comment.
Then what about something like this.
- Provide the block settings via context
- Create
useDoDontItem()anduseDoDontAsset()hooks and mount inside the respective component. These consume the block settings and return the necessary callbacks and values - things that right now we pass as props.
add assets file and tests