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
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.
@ifox ahh yes, that would do it thanks. Possibly Twill 2.x used Vue 2 and 3.x is using Vue 3, then?
No, not yet, we're working on that now but Twill 3 is currently still using vue 2
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
Did you run the twill:build command?
which version of Twill are you on?
3.0. I'll try running it again
try to update to 3.1, there was a bug with custom components in 3.0
Aha, okay, will give it a try
Might this be the bug in question?
Looks like an Alpine.js implementation somewhere is missing a data object
Same issue on 3.2 as well
the error is weird, that dependency is fine. Which node version are you on?
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
rm -rf vendor/area17/twill/node_modules && php artisan twill:build
Same error after that --- only difference was the build process ran for a bit longer than in past after it reinstalled the node modules
So npm ci is successful now, and error is later?
or is it still npm ci failing?
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
I'm not reproducing any of this
Are you on windows?
Hmm no doesn't look like it from your logs
Nope, MacOS 13. M1 chip but I'm running terminal in Rosetta. I know build was working before I upgraded from 2.x
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
You mean what version is listed in package.json?
I'm using nvm but use it universally
no I mean if you run node --version from that directory
I've currently got it at 14.21.2
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
Got it, yeah. I've tried 16 and 18. I can try 20 as well for what it's worth
Just tried 16 and 18 on an M1 too successfully, just not in a Rosetta terminal
Hmm, i think 20 may have just worked
there's not much differences in js deps between twill 2 and 3 so this is quite strange
oh
🤷♂️
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!