-
Notifications
You must be signed in to change notification settings - Fork 372
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
Fix null value errors in attribute casting #1772
Fix null value errors in attribute casting #1772
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@ryanmitchell Are you able to either create an issue with steps or provide steps on how to reproduce this the issue this is fixing as currently I'm not getting any errors |
So it happens for me when I create a new product variant attribute then edit an existing variant but dont blur that field (so leave it blank and never touch it). |
I just tried these steps and everything seemed ok 🤔 here's a quick video of what I did. |
Here's my error trace: https://flareapp.io/share/17WvaBnP |
What does your attribute data look like for the offending product variant? |
|
Strange mine looks basically the same yet unable to reproduce this one, things seem to work as expected. |
Not sure why. I'm on a clean install and it happens consistently on every product. |
I just tried on a new install of the starter kit and I still wasn't able to reproduce this. Are you able to @glennjacobs Might need to ask if you can reproduce this |
Nope it's a pretty clean install at this point. Oh well, must be something on our side, but I've no idea what. That said, it's a pretty simple PR - if the value is null you wouldn't want it being saved anyway? |
Weirdly this just came up on one of our sites 😅 I've assigned @glennjacobs to see if he is able to reproduce. My only concern would be that the attributes should have the correct mapping on save and I'd be worried this would just be masking another issue altogether. |
Oh good that you can see it now, and that I'm not losing my mind. |
I have the bug in the Brand edit page but i can't reproduce the steps |
I’m having same issue and replicable with these steps #1772 (comment) My issue is with Toggle field and so far I traced to this line
By making sure it’s returning 0 or 1 only It also makes me think is there a change in livewire that the issue only happens now 😂 |
@ryanmitchell Finally managed to consistently reproduce this, for me it was to add a new attribute to a different product type and then try switching that product to that type, which caused the error. I switched to the branch on @wychoong 's PR and the error went away |
Great! |
When you add a new attribute and edit a item but dont set a value for it, you receive an error due to the value being null when the cast tries to work out its type.
This PR works around that issue by ignoring null values.