-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Adjusting memoization on the DashWrapper
to be utilized
#3248
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
Conversation
The initial test failed due to not being able to The current test for this hash is If the above is the desired outcome, I recommend having devs add a new prop to components that want to redraw on upstream adjustments and using that to switch to the older function which uses Heck, even adding it as a prop that Dash adds would work. |
There was an issue with the In this PR, we adjusted the A couple of other things that were minor
|
… to update `children`
…w children and generate hashes for them
adjusted the components as props test to work with redrawing
…ender or the target prop being adjusted vs having to crawl with the reducer the layouthash now has the props that triggered the change as well as the number of updates
Another thing on the last comment, I adjusted the way the memoizing works, it only holds onto the last rendered time. This helps with rerenders. |
…render, there is no hash or the component prop is in the changedProps. There was an issue if the component props had changed from the children, it would think that the parents props had changed and needed to re-render.
…nt can subscribe to based upon its prop definitions
I added i.e. when using an api component and |
# Conflicts: # CHANGELOG.md
…ibe, they need to place on the component: `namespace.component.dashRenderType = true`
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.
Nice job, just a few minor comments.
selectDashProps(componentPath), | ||
selectDashPropsEqualityFn | ||
); | ||
|
||
/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unused-vars */ | ||
// @ts-ignore | ||
const newlyRendered = useMemo(() => { |
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 we put as newlyRendered: any
instead of the ts-ignore?
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.
I'll check with the @ts-ignore
the unused vars needs to be ignored.
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.
Still errors out in the build.
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.
Oh, I don't think useMemo
is right in this case, should be useEffect
.
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.
useEffect
is not sync, while useMemo
is sync. For the current
to be used within the same sync it has to be useMemo
.
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.
Went with useMemo
without variable declaration
@@ -41,24 +46,61 @@ type DashWrapperProps = { | |||
*/ | |||
componentPath: DashLayoutPath; | |||
_dashprivate_error?: any; | |||
_passedComponent?: any; | |||
_newRender?: any; |
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.
Maybe add a comment describing those new props.
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.
💃
This is a PR to test the adjustment of memoization on the
DashWrapper
you can see info here: #3243