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

feat: throw when inputContainer refers to an <input> #138

Merged
merged 2 commits into from
Jul 23, 2020

Conversation

sarahdayan
Copy link
Member

We generate the search box for users, but it's likely that they will try to integrate Unified in a website that already has one and will try to hook inputContainer to it. We mention it in the documentation, but we can't rely on this alone, as this is a likely error and it will make Unified fail from the very first try, causing a pretty bad experience.

We've seen that error during user testing, and it results in Preact throwing way too deep for the error to be understandable. This PR introduces a custom error that makes it clear what is happening and what steps to take from there.

src/components/SearchButton.js Outdated Show resolved Hide resolved
@francoischalifour
Copy link
Member

Ideally this kind of checks should be in a runtime validator step but we don't have any yet.

@sarahdayan
Copy link
Member Author

sarahdayan commented Jul 23, 2020

Ideally this kind of checks should be in a runtime validator step but we don't have any yet.

I agree. We can definitely build a runtime validator that runs during development and throws descriptive errors, but disappears in production. I can take care of this in another PR. wdyt?

@francoischalifour
Copy link
Member

Yeah that'd be great!

@sarahdayan sarahdayan merged commit da536fc into next Jul 23, 2020
@sarahdayan sarahdayan deleted the feat/throw-inputcontainer branch July 23, 2020 11:28
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.

None yet

2 participants