I have a tiny repro repo here: https://github.com/filmaj/enhance-my-card-component
It takes the Components docs page @enhance/custom-element example and wraps it in the enhance CLI w/ arc-plugin-enhance.
The dev server (npm start) output looks fine but when you open the browser dev console, the component attributes are said to be empty. Also the titleChanged callback seems to execute before the connectedCallback? Does that make sense?
Reproduction steps:
- Clone https://github.com/filmaj/enhance-my-card-component
npm i and npm start
- Load the URL
- Dev server output looks good:
mycard render start, attrs: {"title":"hello world"} - correct attributes as expected on the server.
- Open browser console and note the errors, as well as order of the callbacks:
- The first log is the render function, and it has no attributes:
mycard render start, attrs: {}
- The second log is
titleChanged callback: mycard titleChanged start
- An exception occurs next:
Uncaught TypeError: can't access property "textContent", this.heading is undefined - probably because the connected callback has not fired yet.
- The third log is the connected callback:
mycard connectedCallback start
- Does the order of these callbacks make sense?
Not an expert in web components or enhance, but I'm trying to progressively-enhance a component with some client-side JS only after a big client JS library is loaded, so the order of callbacks and availability of attributes is key.
I have a tiny repro repo here: https://github.com/filmaj/enhance-my-card-component
It takes the Components docs page
@enhance/custom-elementexample and wraps it in the enhance CLI w/ arc-plugin-enhance.The dev server (
npm start) output looks fine but when you open the browser dev console, the component attributes are said to be empty. Also thetitleChangedcallback seems to execute before theconnectedCallback? Does that make sense?Reproduction steps:
npm iandnpm startmycard render start, attrs: {"title":"hello world"}- correct attributes as expected on the server.mycard render start, attrs: {}titleChangedcallback:mycard titleChanged startUncaught TypeError: can't access property "textContent", this.heading is undefined- probably because the connected callback has not fired yet.mycard connectedCallback startNot an expert in web components or enhance, but I'm trying to progressively-enhance a component with some client-side JS only after a big client JS library is loaded, so the order of callbacks and availability of attributes is key.