(As always with my reakit-system-related requests, please feel free to say I should handle this myself for now.)
I would like warning in reakit-utils to support arbitrary labels and not have reakit hardcoded in the label.
For my component library built with reakit and reakit-system, I'd like the ability to throw warnings in development and have them tagged with the name of my library, not reakit, so that I can control where to tell my engineers to look for internal documentation.
When building custom components using reakit-system, I'd like to use the same useCreateElement / warning() pattern to flag issues in development.
For example, if an engineer passes an invalid icon token to my custom <Icon icon="..." /> component, I would like the warning to use the name of my library (since Reakit does not ship with an Icon component).
reakit in the finalLabel, and require callers of warning to include the full label by default.warning, something like tag or namespace, and default it to 'reakit'. Use that new argument instead of the hardcoded reakit.If one of these implementations is suitable to you, or if there's another you suggest, I'm happy to build it out.
Hey @folz :wave:,
Thank you so much for supporting us on Open Collective :heart:.
We'll give a special attention to this issue.
If we're going to make this more generic (which I'm totally open for), I'd go for an API like this:
warning(
!error,
"[reakit/A]",
"Line 1.",
"Line 2.",
"",
"Line 4"
);
So, in this case, there's no concept of label in the implementation.
Also, make sure you're using it together with babel-plugin-dev-expression. Otherwise, your production bundle will end up with a bunch of strings that can't be minified.
Sounds good to me. I'll whip up a PR removing the concept of label and converting the existing callsites to include [reakit/*]. Should have it over soon.
Most helpful comment
If we're going to make this more generic (which I'm totally open for), I'd go for an API like this:
So, in this case, there's no concept of label in the implementation.