Skip to content

Validate that both createElement *and* render are given #751

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

Closed
Haroenv opened this issue Oct 4, 2021 · 4 comments
Closed

Validate that both createElement *and* render are given #751

Haroenv opened this issue Oct 4, 2021 · 4 comments

Comments

@Haroenv
Copy link
Contributor

Haroenv commented Oct 4, 2021

Description

if you only pass createElement, you mix between preact and react (or whatever else), you get an odd error

possible solutions:

  • make render no longer required (return an element if renderer is passed, render in user land)? (breaking change, longer term)
  • error when render is not given when renderer is given

Reproduction

#750

Steps

  1. pass only renderer
  2. see a funny error when something errors

Expected behavior

A clear error when render is forgotten

Environment

  • OS: [e.g. Windows / Linux / macOS / iOS / Android]
  • Browser: [e.g. Chrome, Safari]
  • Autocomplete version: 1.4.0
@francoischalifour
Copy link
Member

Not sure this is a great solution because you often times just need to override the Autocomplete render function without changing the renderer. For example, when you want to update the panel UI but keep using Preact.

An alternative could be to pass your framework's render function to the renderer option (on top of createElement and Fragment) and to use this render reference in the Autocomplete render function.

@Haroenv
Copy link
Contributor Author

Haroenv commented Oct 13, 2021

yes, that seems like a good idea. What I meant wasn't that it should error when only render is given though. I meant that when you give renderer without render it should error

@sarahdayan
Copy link
Member

Related 🙂

Since we're gonna discuss templating soon, I think we should touch on this topic in the RFC.

@sarahdayan
Copy link
Member

This is covered since 1.6.0.

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

3 participants