-
Notifications
You must be signed in to change notification settings - Fork 674
Conversation
Task linked: SALEOR-1587 Render EditorJS format in storefront |
return editor.current?.destroy; | ||
}, | ||
// Rerender editor only if changed from undefined to defined state | ||
[data === undefined] |
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.
Based on Props type above data
should always be defined, is this condition necessary? If this issue occurs and TS doesn't catch it perhaps something is not typed correctly and a check should be applied before mounting this component
data && <RichTextEditorContent data={data} ... />
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.
Can be undefined if loading. It serves it's purpose in dashboard so we can display outline etc, but we don't have anything like this here
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.
If it's undefined we shouldn't be mounting this component in the first place, if we want to handle undefined state (like loading) it should be reflected in the Props data
type so TS can catch that
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.
Check is also done before mounting.
Strange, when I removed any of those two lines (60 and 62) editor initializes every time I change tabs (description/attrs) so I would say that it works as should and those are needed. WDYT?
// Rerender editor only if changed from undefined to defined state | ||
[data === undefined] | ||
); | ||
React.useEffect(() => editor.current?.destroy, []); |
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.
Duplicate (destructor is already defined above)
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.
It's connected to issue above, probably safe to remove it
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.
It's not necessary no matter the case - all useEffect
hooks call return fn on unmount
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.
Right 🤔
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.
Cypress tests fail
Re console error: codex-team/editor.js#1380 - soon there should be new release |
Cypress seems to be failing because of test database - everything was green at 453c17b, after adding CHANGELOG tests started failing 🌵 |
ddba102
to
fb3d5ea
Compare
Support for new type of renderer (editorjs)
Screenshots
Pull Request Checklist
Test Environment Config
API_URI=https://master.staging.saleor.rocks/graphql/