Saleor: TypeError: Cannot read property 'url' of null

Created on 24 Jul 2019  路  6Comments  路  Source: mirumee/saleor

What I'm trying to achieve

Run Dashboard 2.0

Steps to reproduce the problem

  1. Clone the master branch.
  2. and Install as procedures

Screenshots


Capture
:
Browser: Chrome

bug

Most helpful comment

{user.avatar && <Avatar alt="user" src={user.avatar.url} />}

should be ok.

All 6 comments

Can you share more details about steps that you did?

I found a similar issue yesterday - when you log in to the dashboard and remove your avatar, it fails to renders the avatar component in the top right corner of the dashboard.

Steps to reproduce:

  1. In the Dashboard 2.0 go to Configure > Staff Members
  2. Go to your account details.
  3. Hover on the avatar and click "Delete photo".
  4. Reload the page.

@maarcingebala As what you said is correctly, So I solve the issue by comment the below chip & it works fine.

Capture

If I'm correct a fix for that would be to change this line:
https://github.com/mirumee/saleor/blob/730732000cf0139182c92c52ebd398ab6911d3a8/saleor/static/dashboard-next/components/AppLayout/AppLayout.tsx#L388

with this piece of code:

user.avatar ? (
  <Avatar alt="user" src={user.avatar.url} />
) : null

@dominik-zeglen or @benekex2 if you could verify if this is correct 猬嗭笍. If you have time maybe you can quickly fix it, if not, I'll try to take a look later.

{user.avatar && <Avatar alt="user" src={user.avatar.url} />}

should be ok.

Was this page helpful?
0 / 5 - 0 ratings