Skip to content

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

Closed

Description

@richardvanbergen

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

Activity

  1. github-actions commented on Sep 8, 2024

    @github-actions
    Contributor

    This issue has been automatically locked.
    Please open a new issue if this issue persists with any additional detail.

  2. locked as resolved and limited conversation to collaborators on Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions