Skip to content
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

Array.prototype.flat doesn't exist on older browsers #647

Closed
crnjan opened this issue Dec 16, 2020 · 3 comments · Fixed by #935
Closed

Array.prototype.flat doesn't exist on older browsers #647

crnjan opened this issue Dec 16, 2020 · 3 comments · Fixed by #935
Labels
bug Something isn't working main ui Main UI

Comments

@crnjan
Copy link
Contributor

crnjan commented Dec 16, 2020

Maybe a bit odd issue, but would be great to see OH content on LG TV's build in web browser - overview tab renders fine (at least the content I have in there), but other tabs don't - only separator text is rendered, but not the cards.

Seems as LG webOS uses Chromium 68 (http://webostv.developer.lge.com/discover/specifications/web-engine/); tried to download it (tried with Version 89.0.4358.0) and OH loads fine on my MAC ...

Any suggestions would be appreciated.

(EDIT: tested with OH3 Build #2078)

@crnjan crnjan added bug Something isn't working main ui Main UI labels Dec 16, 2020
@crnjan
Copy link
Contributor Author

crnjan commented Dec 16, 2020

image,50%

Downloaded an older version and can reproduce the same, no idea why webOS 5 (from 2020!) bundles with such old Chromium version. Any chance to somehow make this work on webOS 5 (Chromium 68)?

@ghys
Copy link
Member

ghys commented Dec 17, 2020

image
https://stackoverflow.com/a/50993569

By the way: when you opened that issue, I believe it said up front:

Please DO NOT ERASE this template, but fill in the details as requested. This will ensure your issue is properly filed and will be considered. Otherwise, we may reserve the right to close it without further action.

which you did anyway, and then:

Open the developer tools in your browser, go to the Console tab and paste errors and other messages that might be relevant to this issue. You may also paste a screenshot if you prefer.

That would saved me the hassle of doing it for you. So next time, if you can't be bothered to help by following simple instructions, I won't be bothered to help you.

@crnjan
Copy link
Contributor Author

crnjan commented Dec 17, 2020

Hey!

Let me first try to explain myself - when I created the issue I only seen it on TV (and no error logs there) + downloaded latest Chromium (falsely under the impression webOS includes an up2date browser) - and also got no errors there - since naturally all worked with latest version. And then I filled the issue and there was nothing to add at that time.

Only later I found out webOS uses Chromioum 68 and was then able to reproduce the issue - but failed to provide all the data, sorry for that.

Greatly appreciate your effort (not just regarding this issue, but overall, really enjoying the new UI btw) and thx for providing feedback.

Based on your post I added

if (!Array.prototype.flat) {
  // eslint-disable-next-line no-extend-native
  Array.prototype.flat = function (depth = 1) {
    return this.reduce(function (flat, toFlatten) {
      return flat.concat((Array.isArray(toFlatten) && (depth > 1)) ? toFlatten.flat(depth - 1) : toFlatten)
    }, [])
  }
}

to the top of bundles/org.openhab.ui/web/src/js/app.js, created new jar and updated my OH3 - and it works now!!!

Is there any chance to include something like this to codebase? And if yes, where would be a good place to add it?

EDIT: Moved the missing flat function from app.js and still seems to work :) - change, FYI ...

Thanks again,
Boris

@ghys ghys changed the title Content of locations/equipment/properties tabs not rendered on webOS 5 Array.prototype.flat doesn't exist on older browsers Jan 14, 2021
crnjan added a commit to crnjan/openhab-webui that referenced this issue Mar 4, 2021
…k implementation.

Fixes openhab#647.

Signed-off-by: Boris Krivonog <boris.krivonog@inova.si>
@ghys ghys closed this as completed in #935 Mar 6, 2021
ghys pushed a commit that referenced this issue Mar 6, 2021
Fixes #647.

Signed-off-by: Boris Krivonog <boris.krivonog@inova.si>
ghys pushed a commit that referenced this issue Apr 18, 2021
Fixes #647.

Signed-off-by: Boris Krivonog <boris.krivonog@inova.si>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working main ui Main UI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants