Open gabrielmfern opened 3 months ago
Latest commit: 0504bbbfd7c247cd42b5f03f0e8d9447795bc9a7
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Hmm.. that's a lot of text..Enough to impact the bundle size. We need to filter that out of prod via a dev check.
Hey @ryansolid, thanks for the feedback.
We need to filter that out of prod via a dev check.
Would a check on isDev
be enough here (like bellow), or is there a conventional way? Haven't looked around the code very much to know.
+if (isDev) {
if (typeof this !== "object" || !Object.hasOwn(this, "r")) {
throw new Error(`Seems like you are directly calling a function wrapped in "action". To properly use an action, you will need to first call "useAction".
Also, what parts do you think could be removed to make it more concise? Maybe the parts meant to be code blocks? I suppose they aren't exactly needed, just are good for illustration purposes.
A few times I've called the actions and taking a bit to figure out this was the case, so I decided to add an error message that might be helpful to others in this. The error message currently looks like:
Tried writing it to be clear and show examples so that the person can understand even if they don't end up look into the docs for this.
Examples of how the error looks like on different browsers:
Let me know if the condition it checks for makes sense in this situation.
Thanks!