Open cburn opened 1 year ago
Thanks for the hint, I'll check it out 👍
This is great to see as I have HA running on an old iPad in the kitchen and it works fine but since Power Card Plus has been the primary card on the main dashboard, it's not worked on the iPad so hopefully this means that the old tech has a future again!
Can you check if this fixes the issue, there are still two ??
in there, but maybe it's fixed now
power-flow-card-plus.js.zip
Edit: please make sure in the console shows the version 0.2.0-414 to make sure you are using the correct version
I've had a look deeper in the code at this (I'm pretty new to HA and am using an old iPad in the kitchen too!).
The issue comes from superstruct
where this.failures
is a function with a nullish operator inside. This is because the node modules aren't being transpiled with iOS 12 as a target, just to the current version of node.
So:
babel.config.js gets ["@babel/preset-env", { targets: { node: "current", ios: "12" } }]
and the rollup.config.js gets:
babel({
exclude: /node_modules\/(?!superstruct)\/.*/,
babelHelpers: "bundled",
}),
I'll send over a PR
I have a potential fix for bug #150.
The card is failing to load on on old iOS devices as Safari/Webkit only supported the nullish coalescing operator '??' from iOS version 13.4.
I searched the installed www/community/power-flow-card-plus/power-flow-card-plus.js file for instances of "??" and there were 2 places where it appeared.
I edited
super(a ?? l)
tosuper(( a != null ) ? a : l)
ando ?? (o = [e, ...t()])
to(o != null) ? o : (o = [e, ...t()])
in place and deleted the .gz version of the file, and it works perfectly on an old iPad mini running iOS 12.5.7Sorry I don't know how to fix this in your code/release process but hopefully this points the right direction. Maybe some options to send through babel to target older browsers?