You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had to read the source to realize that not only was it possible to use an existing settings component from Novu, but I just needed to accept a setScreen callback in the header to use the existing transition in the popup component.
π Reproduction steps
N/A
π Expected behavior
header prop of the notification popup should accept a React.FC<{setScreen: (screen: ScreensEnum)=> void}> instead of a ()=>JSX.Element. Or at least it should have that argument signature.
Documentation should show all exported components, the meaning of their arguments, and their purpose.
π Provide any additional context for the Bug.
While you're at it, you might want to look at the performance implications of switching from {header({setScreen})} to <Header {...{setScreen}} />. I'm no expert but I think that the current code could cause React to fail to match the header render-to-render, causing unnecessary computation and DOM updates.
This is related to problems which come up in the context of #3246 .
π Have you spent some time to check if this bug has been raised before?
davidsoderberg
changed the title
β¨ Polishing: Fix docs and types for the header
[NV-2168] β¨ Polishing: Fix docs and types for the header
Apr 25, 2023
hey @david-morris! I'm sorry to hear that the docs were not clear about the available props, we are doing our best to improve it, but sometimes something might be missing because it's really evolving part of the code. Thanks for pointing out that we are missing that part.
I think that we can improve the docs as part of the changes in #3286, because it's related to it and any change in the public API should be reflected in the docs.
Speaking about the performance implications of header({setScreen}), there won't be any, unless you return the same React Element (component).
Having the above in mind I'm gonna close this issue if that is ok for you.
π Description
I had to read the source to realize that not only was it possible to use an existing settings component from Novu, but I just needed to accept a
setScreen
callback in the header to use the existing transition in the popup component.π Reproduction steps
N/A
π Expected behavior
header
prop of the notification popup should accept aReact.FC<{setScreen: (screen: ScreensEnum)=> void}>
instead of a()=>JSX.Element
. Or at least it should have that argument signature.π Provide any additional context for the Bug.
While you're at it, you might want to look at the performance implications of switching from
{header({setScreen})}
to<Header {...{setScreen}} />
. I'm no expert but I think that the current code could cause React to fail to match the header render-to-render, causing unnecessary computation and DOM updates.This is related to problems which come up in the context of #3246 .
π Have you spent some time to check if this bug has been raised before?
π’ Have you read the Contributing Guidelines?
NV-2168
The text was updated successfully, but these errors were encountered: