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

Prop name collisions #679

Open
chrisvxd opened this issue Nov 6, 2024 · 1 comment
Open

Prop name collisions #679

chrisvxd opened this issue Nov 6, 2024 · 1 comment

Comments

@chrisvxd
Copy link
Member

chrisvxd commented Nov 6, 2024

Via Discord

whenever you assign the same name of a specific prop for two different components, for example "content", but you give it different fields configurations, if you swap between selecting one of them to selecting another of them, you get the error
"Rendered fewer hooks than expected. This may be caused by an accidental early return statement."
"The above error occurred in the component: at AutoFieldInternal"

For example if you do a config like this one:

config = {
  components: {
    ComponentA: {
      fields: {
        content: {
          type: "array",
          ...
        }
      },
      render: ({content}) => <ComponentA content={content}/>
    },
    ComponentB: {
      fields: {
        content: {
          type: "custom",
          ...
        }
      },
      render: ({content}) => <ComponentB content={content}/>
    }
  }
}

And you, in the editor, select a component a you have already dragged and drop, change something in the content, and then go to select a component b you already dragged and dropped, then this breakes the whole editor

@chrisvxd
Copy link
Member Author

chrisvxd commented Nov 6, 2024

Struggling to reproduce. Requested reproduction repo via Discord.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant