activitywatch: TypeError: e.slice().map is not a function error after updating to version 0.13
- I am on the latest ActivityWatch version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- OS name and version: Ubuntu 22.04
- ActivityWatch version: 0.13 (deb Installation)
Describe the bug
Since the new version (updated from 0.12.2 to 0.13) the WebUI does not work in Firefox anymore. There is an error
TypeError: e.slice().map is not a function. See dev console (F12) and/or server logs for more info.
Opening the WebUI and everything is fine.
To Reproduce
- Update to the currently newest version 0.13
- starting ActivityWatch via qt (e.g. /opt/activitywatch/aw-qt)
- opening ActivityWatch in firefox (http://localhost:5600/#/activity/HOSTNAME/view/)
Updating
While updating I found that you provide a deb package. I used the generic Linux zip file and started the binary from their.
I installed the deb file and started the application new from the /opt/activitywatch/aw-qt instead of $HOME/.local/bin/activitywatch/aw-qt
Expected behavior
- Do not show the error, show the Activity screen
Documentation
I added some screenshots above, I hope this is fine.
Additional context
Maybe another bug or mistake I made, but I enable since the update and/or enable the rust server my categorization is gone. I don’t think this i related to the firefox bug.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 15 (6 by maintainers)
Commits related to this issue
- fix: started investigating solution for https://github.com/ActivityWatch/activitywatch/issues/1067 — committed to ActivityWatch/aw-webui by ErikBjare 2 years ago
- fix: parse classes and views from localStorage as json fixes https://github.com/ActivityWatch/activitywatch/issues/1067 — committed to ActivityWatch/aw-webui by ErikBjare 2 years ago
- fix: fixes issue with migrating category settings to the server (#583) fixes https://github.com/ActivityWatch/activitywatch/issues/1067 — committed to ActivityWatch/aw-webui by ErikBjare 2 years ago
Clearing your cookies for localhost seems to fix this.
@ErikBjare just wanted to say thanks for developing this application. In recent weeks, I’ve been experimenting with several time-tracking services, such as RescueTime and ManicTime, and I have found ActivityWatch to be both the most user-friendly and the most powerful, due to the RegEx pattern matching.
I really wonder how many users will face this issue when upgrading…
@avi-cenna I edited in a warning in https://github.com/ActivityWatch/activitywatch/issues/1067#issuecomment-2148581034 so people will hopefully realize. Any proper solution would include correctly parsing the localStorage settings and migrating them to the server without any action by the user.
I realized the “
e.slice().mapis not a function” indicates that type ofehas aslice()but not amap()on the resulting type. This probably means thateis a string and not an array as it should be, which indicates thatlocalStorage.categoriesmight not be parsed into JSON.Analysis:
The issue was probably introduced in https://github.com/ActivityWatch/aw-webui/commit/1131f9b59b9291d6f6abe1d51b16a157adcdb815
When parsing we assume settings keys with a
Datasuffix are JSON-serialized: https://github.com/ActivityWatch/aw-webui/blame/05c25c98b172fcb72e2ae7cbf40be6bc77526c65/src/stores/settings.ts#L131-L132But when writing we serialize all objects as JSON, so this may have been a bad assumption: https://github.com/ActivityWatch/aw-webui/blame/05c25c98b172fcb72e2ae7cbf40be6bc77526c65/src/stores/settings.ts#L183
This worked before the commit, since
classeswasn’t read from localStorage in thesettings.tspinia store before (fixed in https://github.com/ActivityWatch/aw-webui/pull/572).I would assume that it’s a problem with the migration to the server-side settings
I think I have a fix in https://github.com/ActivityWatch/aw-webui/pull/583, but I would appreciate a review/test from someone.
I confirm that clearing cookies resolved the issue. FWIW, here are the instructions to clear cookies for a single website in Chrome.