-
Notifications
You must be signed in to change notification settings - Fork 405
Partial Fix for Code Panel Toggle JS Errors on Master #906
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
Partial Fix for Code Panel Toggle JS Errors on Master #906
Conversation
…data before attempting to parse expected JSON. Partial fix to pattern-lab#761 as this should at least help prevent the current batch of JS errors from getting thrown
|
Love this - reviewing soon! |
bmuenzenmeyer
left a comment
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.
Something is either wrong with this or how I am testing it.
I couldn't get the uikit to compile without changing a few things (const back to var), defining var patternMarkupEl
and then I couldn't reliably get the issue to occur prior to the fix being applied.
Can you run npm run watch and confirm it builds for you?
|
@bmuenzenmeyer hmmmm lemme take a look and I'll get back to you on this one! |
…abel just yet.. update Prettier config to ignore Uikit's JavaScript for the time being
|
ok I think I figured out the issue you ran into @bmuenzenmeyer after walking through this step by step -- basically, Prettier is currently set to lint / auto-format all JS in the monorepo which, incidentally, includes the very-much-in-need-of-refactoring JavaScript in Pattern Lab's UIkit. That would explain why this change originally worked / built without issues on my end initially but I ran into the same problems you did after pulling my branch back down and re-running. I've went back in and (for the time being at least) updated the root
{
"cacheBust": true,
"cleanPublic": true,
"defaultPattern": "all",
"defaultShowPatternInfo": false,
"ishControlsHide": {
"s": false,
"m": false,
"l": false,
"full": false,
"random": false,
"disco": false,
"hay": true,
"mqs": false,
"find": false,
"views-all": false,
"views-annotations": false,
"views-code": false,
"views-new": false,
"tools-all": false,
"tools-docs": false
},
"ishViewportRange": {
"s": [240, 500],
"m": [500, 800],
"l": [800, 2600]
},
"logLevel": "info",
"outputFileSuffixes": {
"rendered": ".rendered",
"rawTemplate": "",
"markupOnly": ".markup-only"
},
"paths": {
"source": {
"root": "./node_modules/@pattern-lab/starterkit-mustache-demo/dist",
"patterns": "./node_modules/@pattern-lab/starterkit-mustache-demo/dist/_patterns/",
"data": "./node_modules/@pattern-lab/starterkit-mustache-demo/dist/_data/",
"meta": "./node_modules/@pattern-lab/starterkit-mustache-demo/dist/_meta/",
"annotations": "./node_modules/@pattern-lab/starterkit-mustache-demo/dist/_annotations/",
"styleguide": "dist/",
"patternlabFiles": {
"general-header":
"views/partials/general-header.mustache",
"general-footer":
"views/partials/general-footer.mustache",
"patternSection":
"views/partials/patternSection.mustache",
"patternSectionSubtype":
"views/partials/patternSectionSubtype.mustache",
"viewall":
"views/viewall.mustache"
},
"js": "./node_modules/@pattern-lab/starterkit-mustache-demo/dist/js",
"images": "./node_modules/@pattern-lab/starterkit-mustache-demo/dist/images",
"fonts": "./node_modules/@pattern-lab/starterkit-mustache-demo/dist/fonts",
"css": "./node_modules/@pattern-lab/starterkit-mustache-demo/dist/css"
},
"public": {
"root": "public/",
"patterns": "public/patterns/",
"data": "public/styleguide/data/",
"annotations": "public/annotations/",
"styleguide": "public/styleguide/",
"js": "public/js",
"images": "public/images",
"fonts": "public/fonts",
"css": "public/css"
}
},
"patternExtension": "mustache",
"patternStateCascade": ["inprogress", "inreview", "complete"],
"patternExportDirectory": "./pattern_exports/",
"patternExportPatternPartials": [],
"serverOptions": {
"wait": 1000
},
"starterkitSubDir": "dist",
"styleGuideExcludes": [],
"theme": {
"color": "light",
"density": "compact",
"layout": "horizontal"
},
"uikits": [
{
"name": "uikit-workshop",
"outputDir": "",
"enabled": true,
"excludedPatternStates": [],
"excludedTags": []
}
]
}
BeforeAfter |
|
I no longer see the error. I think it's a separate issue that the panel does not open in the view-all screens. |
|
Thanks for the stellar work and testing directions, by the way! |
…el-toggle-fix Partial Fix for Code Panel Toggle JS Errors on Master


Checks to make sure the code panel-related <script> tag contains data before attempting to parse expected JSON.
Partial fix to #761 as this should at least help prevent the current batch of JS errors from getting thrown till the larger data structure changes that caused this issue are identified and a fix rolled up.
Related to #905 as Twig allows us to massage the data available at the template level to work around whatever data changes happened to cause this bug in the first place.