-
Notifications
You must be signed in to change notification settings - Fork 3
Noci fix dropdown #185
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
Noci fix dropdown #185
Conversation
| @@ -0,0 +1,42 @@ | |||
| /* eslint-disable max-params */ | |||
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 see this being disabled in a lot of places. If it doesn't match our coding style here, should we disable it from our eslint config?
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 even needed here anymore I'm removing it.
I'd rather we leave it since it gives an indicator even we bypass it that the hook might need refacotoring or split.
| @@ -0,0 +1,76 @@ | |||
| /* eslint-disable max-params */ | |||
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.
Might be a good idea to rename this file to index.ts to avoid having imports with ../useSections/useSections, specially if this hook is exposed to users.
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.
Good callout!
| // Access the Pods Data from the Recommendations response to update Active Sections configuration | ||
| useEffect(() => { | ||
| if (!recommendations.podsData) { | ||
| setPodsData(recommendations.podsData); |
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.
Is this only ever set if podsData is falsy? Or does podsData get a value set to it elswhere?
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.
Is this only ever set if podsData is falsy
Here yes. "setPodsData" only purpose is to give useRemoveSections access to recommendations.podsData
If we didn't have useRemoveSections all code related to saving podsData in state would be removed since already we are keeping track of podsData in a different useState is in useFetchRecommendationPod
This is the actual change https://github.com/Constructor-io/constructorio-ui-autocomplete/pull/185/files#diff-e01e5eee29c745e3c8683f0945e6922b47b1fc39888e1c3ce8d4b6c7a7964184R21
The rest is much-needed refactoring since the code was highly not readable
Before

After
