You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I cannot extract meta of react functional-component, while class component works well.
constExternalShortcut: React.FC<Props>=()=>{return<div>example</div>};// It doesn't work..//...classExternalShortcutextendsReact.Component<Props,any>{render(){return<div>example</div>;}}// It works!
dash/extract-meta.js throws the error.
if(commentSource.valueDeclaration){^
TypeError: Cannotreadpropertiesofundefined(reading'valueDeclaration')at/Users/devsisters/Development/dashapp-poc-dashboard/src/components/lnb/venv/lib/python3.9/site-packages/dash/extract-meta.js:694:31atArray.forEach(<anonymous>)
at /Users/devsisters/Development/dashapp-poc-dashboard/src/components/lnb/venv/lib/python3.9/site-packages/dash/extract-meta.js:645:17
at Array.forEach (<anonymous>)
at gatherComponents (/Users/devsisters/Development/dashapp-poc-dashboard/src/components/lnb/venv/lib/python3.9/site-packages/dash/extract-meta.js:640:33)
at Object.<anonymous> (/Users/devsisters/Development/dashapp-poc-dashboard/src/components/lnb/venv/lib/python3.9/site-packages/dash/extract-meta.js:754:18)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
This is how I fixed.
// Function components.rootExp=typeSymbol;// rootExp.valueDeclaration = rootExp.declarations[0]; // This line is what I add. This line makes the build of functional component success.commentSource=rootExp.valueDeclaration;if(rootExp.valueDeclaration&&rootExp.valueDeclaration.parent){// Function with export later like `const MyComponent = (props) => <></>;`commentSource=getParent(rootExp.valueDeclaration.parent);}
Expected behavior
I expected to extract-meta.js work well for react functional-component.
The text was updated successfully, but these errors were encountered:
a function component cannot have empty props but that should be valid (eg; const Component = () => <div>foo</div>) throws:Uncaught TypeError: Cannot convert undefined or null to object
pip list | grep dash
belowDescribe the bug
I cannot extract meta of react functional-component, while class component works well.
dash/extract-meta.js
throws the error.This is how I fixed.
Expected behavior
I expected to
extract-meta.js
work well for react functional-component.The text was updated successfully, but these errors were encountered: