-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[addon-knobs] unexpected string type conversion on a ISO-8601 formatted string #6243
[addon-knobs] unexpected string type conversion on a ISO-8601 formatted string #6243
Comments
I investigated this and found that problem in telejson stringify. Ok it's not really the problem, but telejson convert strings as a '2019-03-08T07:27:34.000Z' date.
|
Oh man, thank you for debugging this! I guess this also explains some mysterious behaviour that I really didn't understand while I'm writing customized add-on. I was used Symbol as a token to avoid potential event collision but it is always showing my symbol is not the same symbol between one side to the other. And just guessing, maybe not so relevant. I have also noticed that if my knob used with name like |
For example, like this in v5.0.2: import React from 'react';
import { storiesOf } from '@storybook/react';
import { boolean as bool, text } from '@storybook/addon-knobs';
const X = () => <div>X</div>;
storiesOf('X', module).add('X', () => {
return (
<X
name="checkbox"
meta={{
submitting: bool('meta.submitting', false),
pristine: bool('meta.pristine', true),
error: text('meta.error', ''),
}}
/>
);
}); I can only see |
Ok, I repro. But I have no idea what it is. 🤔
Man, we need a support. Its a magic. |
I have taken a glimpse into the source code and found they are basically outputs in a factory, or saying derivatives of a class per se. I have also suspected the root cause may come from |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
I think this might have been addressed by @ndelangen in https://github.com/storybooks/storybook/pull/6486/files @leoyli would you mind checking this out and letting me know if it's fixed? |
@shilman Thanks! It fixed. I will open another issue for the other issue I've been mentioned, which wasn't fixed. |
Describe the bug
If
text
knob take a string like2019-03-08T07:27:34.000Z
as a default value, it can give console errors. This is due to internally it take this ISO-8601 date string and parse it to give a date-typed object. This is then output as, for example,Fri Mar 08 2019 02:27:34 GMT-0500 (Eastern Standard Time)
string. Kind of magic and surprise.To Reproduce
Steps to reproduce the behavior:
official-storybook
addons-knobs-withknobs--tweaks-static-values
story2019-03-08T07:27:34.000Z
Expected behavior
Have no change its type or any sort of unexpected transformation on string. Note, this is nothing to do with
escapeHTML
knob configs.Screenshots
N/A
Code snippets
N/A
System:
Additional context
N/A
The text was updated successfully, but these errors were encountered: