-
Notifications
You must be signed in to change notification settings - Fork 72
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
[Fix] "Guidelines" Documentation Render Blank Page #1111
[Fix] "Guidelines" Documentation Render Blank Page #1111
Conversation
Signed-off-by: Willie Hung <[email protected]>
While investigating this issue, I found it challenging to identify the bug due to the implicit typing of variables. For example, the main issue lies in the fact that Do we have any plans to migrate some of these files to TypeScript for better type safety? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Willie-The-Lord
PR details need to update in CHANGELOG.md
Thank you for the heads up! |
Signed-off-by: Willie Hung <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the minor comment I made, the changes LGTM! I have already reviewed the code and tested it locally. Indeed, the problem was tricky, as @Willie-The-Lord mentioned.
Unfortunately, not really. These variables are extracted from Sass, using custom scripts: https://github.com/opensearch-project/oui/blob/main/scripts/babel/variables-from-scss/index.js and https://github.com/opensearch-project/oui/blob/main/scripts/lib/compile-scss-with-variables.js. I think the format changed from color: {
r: string;
g: string;
b: string;
a: string;
rgba: string;
} into color: string Which is where the errors come from. We might be able to add some sort of type safety by updating the Webpack plugin.
To this point, the generates vars are just all of the Sass vars in the projects put into a JSON object. So for whatever reason we have these variables which are used in different ways, all just extracted and put into a single object. |
Just asking here if we should simplify the JSON object to avoid DRY. It does not make sense to have the same value for 2 distinct keys. Of course, this will mean refactoring the code in other parts. Regards, Samuel |
I don't think we have any overall issue for migrating OUI from JS to TS, but I think you could open one with this as an example of why it may be worth the effort to do. The good thing about typescript conversions is that they can be parallelized and worked on as good first issues. |
@BigSamu This has to do with the way we use SASS vars in the project. In many cases, it's useful to have multiple aliases that map to different usages even if (in some themes) they actually use the same underlying value. When you look at the JSON file (or the output of In your example, in that theme the But each theme is free to define the relationship between the |
Thanks @joshuarrrr for the detailed explanation! It makes sense that the flexibility is beneficial, especially when we consider the implementation across various themes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome fix @Willie-The-Lord - just a couple minor questions and suggestions.
Co-authored-by: Josh Romero <[email protected]> Signed-off-by: Willie Hung <[email protected]>
Co-authored-by: Josh Romero <[email protected]> Signed-off-by: Willie Hung <[email protected]>
* Update error color type Signed-off-by: Willie Hung <[email protected]> * Add CHANGELOG.md Signed-off-by: Willie Hung <[email protected]> * Update src-docs/src/views/guidelines/colors/vis_palette.js Co-authored-by: Josh Romero <[email protected]> Signed-off-by: Willie Hung <[email protected]> * Update CHANGELOG.md Co-authored-by: Josh Romero <[email protected]> Signed-off-by: Willie Hung <[email protected]> --------- Signed-off-by: Willie Hung <[email protected]> Co-authored-by: Josh Romero <[email protected]> (cherry picked from commit 9ba6199) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
Many thanks @joshuarrrr! Pretty clear the explanation! |
* Update error color type Signed-off-by: Willie Hung <[email protected]> * Add CHANGELOG.md Signed-off-by: Willie Hung <[email protected]> * Update src-docs/src/views/guidelines/colors/vis_palette.js Co-authored-by: Josh Romero <[email protected]> Signed-off-by: Willie Hung <[email protected]> * Update CHANGELOG.md Co-authored-by: Josh Romero <[email protected]> Signed-off-by: Willie Hung <[email protected]> --------- Signed-off-by: Willie Hung <[email protected]> Co-authored-by: Josh Romero <[email protected]> (cherry picked from commit 9ba6199) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
Resolve the issue where the Source Documentation would render blank pages when users clicked on either the "Colors" or "Sass" sections.
Issues Resolved
Closes #1109
Screenshot
Before
before-1.mov
After
after.mov
Check List
yarn lint
yarn test-unit