Skip to content
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

fix(interactions) Blank page when the actions add-on is disabled. #19069

Closed
wants to merge 1 commit into from
Closed

fix(interactions) Blank page when the actions add-on is disabled. #19069

wants to merge 1 commit into from

Conversation

gcoguiec
Copy link

Issue: -

Setting the actions: { disable: true } parameter locally (or globally) with the interactions-addon installed and loaded will render a blank page.

Before:
Kapture 2022-08-31 at 14 29 25

What I did

I wrote a small workaround to skip the panel rendering if actions are disabled.

After:
Kapture 2022-08-31 at 14 40 46

How to test

I added a minimal test case inside the Panel test suite:
yarn test interactions/src/Panel -t 'should render an empty panel'

@@ -75,6 +75,11 @@ export const getInteractions = ({
};

export const Panel: React.FC<{ active: boolean }> = (props) => {
// Panel requires an enabled actions addon.
if (useParameter('actions', { disable: false })?.disable) {
Copy link
Member

Choose a reason for hiding this comment

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

i would move this to after hook calls as this breaks the rules of hooks https://reactjs.org/docs/hooks-rules.html

Copy link
Author

@gcoguiec gcoguiec Sep 2, 2022

Choose a reason for hiding this comment

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

@wuweiweiwu Thank you for your time reviewing my PR!
I initially wrote the logic after all the hook calls and found out the first hook calls caused the blank page issue, so I had to move the validation check before the first useState for the workaround to work correctly.

@gcoguiec gcoguiec closed this Sep 3, 2022
@gcoguiec gcoguiec deleted the fix/interactions-actions-disabled branch September 5, 2022 16:45
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.

2 participants