Skip to content

Conversation

@Hyperkid123
Copy link
Contributor

Partially helps with: #7810

@patternfly-build
Copy link
Collaborator

patternfly-build commented Aug 10, 2022

@Hyperkid123 Hyperkid123 force-pushed the remove-listener-default-prop branch from a0fa31c to 07b1f4c Compare August 10, 2022 15:15
isManagedSidebar: false,
isBreadcrumbWidthLimited: false,
defaultManagedSidebarIsOpen: true,
onPageResize: (): void => null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though this technically unnecessary, we consider changes to default values breaking. Could you please update the PR to change the logic at conditional instead.
WE can open a separate issue to remove needed default in a breaking change release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tlabaj we can't change the logic at the condition level. The condition itself is correct but the supplied values are not. The condition checks for the function's existence. And the function is always defined. So the condition is actually buggy and can never be false. That is what breaks the environment.

I've put all the details into the linked issue.

The only other option is adding a new flag that would just disable the observer. But again, looking at the condition logic, the existance of a prop is what should decide the outcome.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other alternative that would allow proper opting-out of the page resizing behavior without potentially causing breaking changes: we could update the type for onPageResize to be a union of the current type and null or something to that effect.

@Hyperkid123 do you have any thoughts regarding that potential approach? I know it isn't ideal, but I think it would be the simplest approach to getting you unblocked until our next breaking change release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I am on board with that. Let me update the PR then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hyperkid123 I opened issue #7861 to address the default value for our next major release.

@Hyperkid123 Hyperkid123 force-pushed the remove-listener-default-prop branch 2 times, most recently from e2d5f23 to e12678b Compare August 18, 2022 08:00
Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

* Returns object { mobileView: boolean, windowSize: number }
*/
onPageResize?: (object: any) => void;
onPageResize?: (object: any) => void | null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this typing would still require a function, but the function could just return void | null and that the following type is what you'd really need.

Suggested change
onPageResize?: (object: any) => void | null;
onPageResize?: ((object: any) => void) | null;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, you are correct. This just changes the return type

@Hyperkid123 Hyperkid123 force-pushed the remove-listener-default-prop branch from e12678b to 5b9405c Compare August 18, 2022 13:56
@Hyperkid123 Hyperkid123 requested review from wise-king-sullyman and removed request for kmcfaul August 18, 2022 13:56
Copy link
Collaborator

@wise-king-sullyman wise-king-sullyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be good! I will approve and merge as soon as it passes CI 🙂

Copy link
Collaborator

@wise-king-sullyman wise-king-sullyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@wise-king-sullyman wise-king-sullyman merged commit 3c68c42 into patternfly:main Aug 18, 2022
@Hyperkid123 Hyperkid123 deleted the remove-listener-default-prop branch August 19, 2022 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants