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

Error when saving a product with a Lunar\FrieldTypes\TranslatedText attribute #1655

Open
MedRochonTolle opened this issue Mar 18, 2024 · 8 comments · May be fixed by #1691
Open

Error when saving a product with a Lunar\FrieldTypes\TranslatedText attribute #1655

MedRochonTolle opened this issue Mar 18, 2024 · 8 comments · May be fixed by #1691
Labels
1.x bug Something isn't working
Milestone

Comments

@MedRochonTolle
Copy link

MedRochonTolle commented Mar 18, 2024

  • Lunar version: 1.0.0-alpha.7
  • Laravel Version: 10.48.3
  • PHP Version: 8.1.27
  • Database Driver & Version: MySql 8

Expected Behaviour:

Save your product and the data is saved

Actual Behaviour:

When you save the product you get an error

Steps To Reproduce:

Add an Attribute Group with an attribute of type Lunar\FrieldTypes\TranslatedText to a product type.

Try to save the product.

You get the error

Lunar\FieldTypes\TranslatedText value must be a collection.

Additional info:

I think the error occurs since this fix but I'm not sure: #1639

Looks like I'm not able to save the description field either, but there's no error.

image

@MedRochonTolle MedRochonTolle added bug Something isn't working unconfirmed labels Mar 18, 2024
@glennjacobs glennjacobs added this to the v1.0 milestone Mar 18, 2024
@lguichard
Copy link
Contributor

lguichard commented Mar 18, 2024

Thanks for your feedback. It appears after recents changes on this commit 172f595

@ryanmitchell do you have an idea ?

I’ll review my code about TranslatedText

@ryanmitchell
Copy link
Contributor

I don't see this error in alpha7 - saving works fine for me on translated fields.

@jerwinaton
Copy link

Same issue here,

  • Lunar version: 1.0.0-alpha.7
  • Laravel Version: 10.43
  • PHP Version: 8.2
  • Database Driver & Version: MySql 8

Mine was when after creating a new product, and then update the brand or description.

You get the error

Lunar\FieldTypes\TranslatedText value must be a collection.

@wch-andrzej-k
Copy link

I have the same issue that occurs when I try to update the basic product data.

Lunar version: 1.0.0-alpha.7

@olivierguerriat
Copy link

olivierguerriat commented Mar 21, 2024

I have a similar error with ListField on 1.0.0-alpha.8 (after further testing, it appears to be introduced by 1.0.0-alpha.6):

Lunar\FieldTypes\ListField value must be an array.

when saving a product variant's "basic information" page.

@olivierguerriat
Copy link

For ListField, 172f595 appears to override the dehydrateStateUsing function used in Support/FieldTypes/ListField.php.

But TranslatedText doesn't use dehydrateStateUsing itself.

@bangnokia
Copy link
Contributor

I can confirm I got that too, when editting product and collection

alecritson pushed a commit that referenced this issue Apr 10, 2024
This PR fix issue #1655.

After recents changes, the line has accidentally remove. Livewire
Synthesizers need a type to hydrate and dehydrate state of component.
@alecritson
Copy link
Collaborator

I'm fairly certain (correct me if i'm wrong) but this is as a result of changing the type of the attribute after you have a product created. So it's not updated the attribute_data to be in the new format and so if you're going from TranslatedText to Text you will see [Object, Object] in the input field, but going from Text to TranslatedText you will get the error above? 🤔

@alecritson alecritson linked a pull request Apr 11, 2024 that will close this issue
@glennjacobs glennjacobs added the 1.x label May 20, 2024 — with Linear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants