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

Adding conditional to blocks field type causes admin UI to hang #77

Closed
richardvanbergen opened this issue Feb 20, 2021 · 0 comments · Fixed by #78
Closed

Adding conditional to blocks field type causes admin UI to hang #77

richardvanbergen opened this issue Feb 20, 2021 · 0 comments · Fixed by #78

Comments

@richardvanbergen
Copy link

richardvanbergen commented Feb 20, 2021

Bug Report

I tried to add a condition to the blocks field type because I don't want it to be visible unless it's being used. Clicking the sibling "hasSubmenu" checkbox causes the admin UI to freeze and task has to be forcefully killed.

{
  type: 'checkbox',
  name: 'hasSubmenu',
  label: 'Has Submenu?',
},
{
  type: 'blocks',
  label: 'Sub Menu Columns',
  name: 'subMenuColumns',
  blocks: [
    SubmenuLink
  ],
  admin: {
    condition: (data: MainMenu, siblingData: MenuItem): boolean => {
      return siblingData?.hasSubmenu || false
    }
  }
}

Expected Behavior

Doesn't hang admin interface. 🥺

Current Behavior

Hangs admin interface. 😤

Possible Solution

Definately an infinite loop of some kind.

Detailed Description

No errors in console.

Payload version: 0.2.12

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 a pull request may close this issue.

1 participant