Upgrading custom form fields from 2.x to 3.x?

I noticed after upgrading Twill to 3.x from 2.x that my custom form fields no longer work. Is there a guide somewhere for how to upgrade them? I did notice that there doesn't seem to be a section in 3.x any longer about custom fields, in the docs.
29 Replies
ifox
ifox8mo ago
Hi @siașamaideparte the content you're looking for is probably this: https://twillcms.com/guides/creating_custom_components_form_fields_and_blocks.html#content-part-3---custom-form-field-example There shouldn't be any upgrade needed between twill 2 and 3.
Twill
siașamaideparte
siașamaideparteOP8mo ago
@ifox ahh yes, that would do it thanks. Possibly Twill 2.x used Vue 2 and 3.x is using Vue 3, then?
ifox
ifox8mo ago
No, not yet, we're working on that now but Twill 3 is currently still using vue 2
siașamaideparte
siașamaideparteOP8mo ago
Okay, I reviewed my custom field and and code in each component and it seems to be exactly like the example in terms of structure and implementation. I tried even putting a dd/ray call in the field blade and it's not being called. it seems rather odd to me. I can post up my simple implementation on a gist if that helps at all. It's odd that it's not even calling the field blade though
ifox
ifox8mo ago
Did you run the twill:build command? which version of Twill are you on?
siașamaideparte
siașamaideparteOP8mo ago
3.0. I'll try running it again
ifox
ifox8mo ago
try to update to 3.1, there was a bug with custom components in 3.0
siașamaideparte
siașamaideparteOP8mo ago
Aha, okay, will give it a try
siașamaideparte
siașamaideparteOP8mo ago
Might this be the bug in question?
No description
siașamaideparte
siașamaideparteOP8mo ago
Looks like an Alpine.js implementation somewhere is missing a data object Same issue on 3.2 as well
ifox
ifox8mo ago
the error is weird, that dependency is fine. Which node version are you on?
siașamaideparte
siașamaideparteOP8mo ago
I was on 14 initially when I saw it -- tried to switch to 16 for good measure and same error (reinstalling the deps after switching) Trying 18 now for kicks
ifox
ifox8mo ago
rm -rf vendor/area17/twill/node_modules && php artisan twill:build
siașamaideparte
siașamaideparteOP8mo ago
Same error after that --- only difference was the build process ran for a bit longer than in past after it reinstalled the node modules
ifox
ifox8mo ago
So npm ci is successful now, and error is later? or is it still npm ci failing?
siașamaideparte
siașamaideparteOP8mo ago
It's still npm ci failing If I go back down to 3.0 I get npm ci failing but it's a different set of issues In 3.0 I get errors related to tiptap, it can't resolve a bunch of prosemirror related deps
siașamaideparte
siașamaideparteOP8mo ago
No description
ifox
ifox8mo ago
I'm not reproducing any of this Are you on windows? Hmm no doesn't look like it from your logs
siașamaideparte
siașamaideparteOP8mo ago
Nope, MacOS 13. M1 chip but I'm running terminal in Rosetta. I know build was working before I upgraded from 2.x
ifox
ifox8mo ago
If you go to vendor/area17/twill, which node version do you get. Asking because you may be using something like nvm with a configuration that changes depending on the directory
siașamaideparte
siașamaideparteOP8mo ago
You mean what version is listed in package.json? I'm using nvm but use it universally
ifox
ifox8mo ago
no I mean if you run node --version from that directory
siașamaideparte
siașamaideparteOP8mo ago
I've currently got it at 14.21.2
ifox
ifox8mo ago
I can't confirm if Twill 3 dependencies would install correctly with 14.21.2, but I can always try. What I was trying to check is if your node version is the same when you do twill:build from your project and when you do npm ci manually in the vendor directory I know they do on 16/18/20
siașamaideparte
siașamaideparteOP8mo ago
Got it, yeah. I've tried 16 and 18. I can try 20 as well for what it's worth
ifox
ifox8mo ago
Just tried 16 and 18 on an M1 too successfully, just not in a Rosetta terminal
siașamaideparte
siașamaideparteOP8mo ago
Hmm, i think 20 may have just worked
ifox
ifox8mo ago
there's not much differences in js deps between twill 2 and 3 so this is quite strange oh 🤷‍♂️
siașamaideparte
siașamaideparteOP8mo ago
Yeah it's all pretty weird. I can tell you that I have a knack for finding inexplicable things though. So it's probably on me 🙂 Yeah, ran it again with 20 and it worked fine That's an odd one, but I'll take it! Yep, all fixed. I appreciate the direction!
Want results from more Discord servers?
Add your server