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

Avatar errors with username is null #1856

Closed
raimund-schluessler opened this issue Apr 17, 2021 · 2 comments
Closed

Avatar errors with username is null #1856

raimund-schluessler opened this issue Apr 17, 2021 · 2 comments
Labels
bug Something isn't working feature: avatar Related to the avatar component

Comments

@raimund-schluessler
Copy link
Contributor

The usernameToColor function in the Avatar component sometimes fails with this error in the Calendar app:

TypeError: username is null
    usernameToColor Avatar.js:3552
    avatarStyle Avatar.js:509
    VueJS 4
    render Avatar.js:2087
    VueJS 5
vue.runtime.esm.js:1888
    VueJS 96
    tasks calendars.js:376
    appendTasksToCalendar calendars.js:371
    wrappedMutationHandler vuex.esm.js:844
    commitIterator vuex.esm.js:466
    commit vuex.esm.js:465
    _withCommit vuex.esm.js:624
    commit vuex.esm.js:464
    boundCommit vuex.esm.js:409
    getTasksFromCalendar calendars.js:658
    wrappedActionHandler vuex.esm.js:851
    dispatch vuex.esm.js:516
    boundDispatch vuex.esm.js:406
    fetchTasks App.vue:98
    fetchTasks App.vue:98
    beforeMount App.vue:88
    VueJS 16
    <anonym> main.js:74
    <anonym> tasks-main.js:204201
    <anonym> tasks-main.js:204203

The Avatar component is used like this: https://github.com/nextcloud/calendar/blob/master/src/components/Shared/CalendarPickerOption.vue#L34-L41
It seems the avatars are rendered correctly in the end.

Happens with nextcloud-vue latest master 5653d19

@raimund-schluessler
Copy link
Contributor Author

I turns out I was using it wrong. When no user was found, I set the display-name prop to null, but the Avatar component only checks for undefined.

When instead providing undefined, no error is thrown, see nextcloud/tasks#1576. Hence, I close this issue.

However, I wonder whether the Avatar component should also check for null and treat it as undefined? @skjnldsv

@skjnldsv
Copy link
Contributor

However, I wonder whether the Avatar component should also check for null and treat it as undefined? @skjnldsv

Sure, I see no issues with that 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature: avatar Related to the avatar component
Projects
None yet
Development

No branches or pull requests

2 participants