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

New bug in bigdclock.app.js #3320

Merged
merged 4 commits into from
Apr 2, 2024
Merged

Conversation

deirdreobyrne
Copy link
Contributor

The value of "width" was being reset somewhere, which meant that the battery usage feature wasn't working - it was resetting to "battery empty" whenever the clock updated.

So "width" has been renamed to "batteryUsedWidth", which is better anyway, as it is more descriptive of what the variable does.

The value of "width" was being reset somewhere. So "width" has been renamed to "batteryUsedWidth", which is better anyway.
@gfwilliams
Copy link
Member

Thanks! That's interesting - it might be interesting to see what's overwriting width as whatever it is likely shouldn't be changing global - maybe it's some widget/similar.

Please can you add a changelog entry and bump the version and we can change this?

@deirdreobyrne
Copy link
Contributor Author

Done (I think - git is still confusing to me). No idea as to how to check what might be changing width. Problem started after I updated my apps, and installed a BLE advertising app.

@gfwilliams
Copy link
Member

Thanks! Looks good!

@gfwilliams gfwilliams merged commit e769b34 into espruino:master Apr 2, 2024
1 check passed
@gfwilliams
Copy link
Member

Just to add, for debugging, maybe since now you're not using width you could look at the value it gets set to, and that might give you some hint as to which app is causing the problem

@deirdreobyrne
Copy link
Contributor Author

It gets set to zero. So no help there :/

@gfwilliams
Copy link
Member

Actually that is some help :) Maybe check in WIDGETS and see if any of those have zero width, and then see if when you can get those widgets to show up, width changes?

@bobrippling
Copy link
Collaborator

One other way to check would be to do this in the IDE:

Object.defineProperty(global, "width", { set: () => { throw new Error("tried to set width"); } })

then watch the console for a log appearing that looks like this:

Uncaught Error: tried to set width
 at line 1 col 13
throw new Error("tried to set width");
                    ^
in function called from line 1 col 5
width=3
    ^

@gfwilliams
Copy link
Member

@bobrippling that's really cool. It made me realise we should try and put some of these tips into a page. I've started a Wiki at https://github.com/espruino/BangleApps/wiki/Debugging-Tips - if you have any more magic tricks like this, please could you add them?

@bobrippling
Copy link
Collaborator

Time served debugging minified webapps! Good idea, I'll add to that if I think of any more.

That tip about global["\xff"] is very useful btw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants