Hey, I’ve been learning Phoenix for a few weeks now. It’s kind off difficult because I’m not used to any of the things used in the framework.
I noticed a recent commit to the framework removes the <.simple_form> component which I heavily use in my learning app.
I now have trouble understanding:
Why it was removed? I get that the core_components file is just examples on how I can build components from functions, but now I do not know if the one I used is still safe to be used, as there is no explanation on why it was removed.
Should I continue learning Phoenix, even though my learning experience will regularly get disrupted by changes like this? It’s not easy learning something only for it to fundamentally work different in a couple of weeks.
I do not even know how to refactor my app, as forms are nowhere explained. <.simple_form> was the only thing I could somewhat grasp how forms work with liveviews and changesets.
I do not want to nag, I am just frustrated because I feel like a week of my time got shattered without explanation.
<.simple_form> didn’t really do much. It was a really shallow wrapper around Phoenix.Component.form/1. You can see that when looking at the same commit, but where simple_form was removed.
Given the above I can asure you nothing changed in that regard. <.simple_form> did nothing to how forms worked to begin with. All it did was add not-even-a-handful of <div>s to your markup.
I think that’s a bit of a premature fear. Watching development as it happens means you’ll get to see changes without much explanations – it’s by definition work in progress. There might be follow up changes, which add documentations, change logs and migration guides, but usually that stuff happens when moving closer to a release date given there’s always a chance things will still change more till a release and you don’t want to waist effort in documenting stuff only to need to update it again a few times before it’s released.
Also nothing changed for your project that you’re working on and nothing will change. core_components are in your project and phoenix doesn’t touch those once generated. The change made on phoenix repo just means a new phoenix project might generate different code, but that’s the same no matter what framework you’re looking at. They’ll all have codebases look more or less different between different versions of the framework.
This is also not the first time components were removed. E.g. <.modal> used to be generated by the 1.7 branch, but got removed because the generators no longer use modals. So new projects generated after that change would need to pull in their own modal component if they needed one.
I guess one final note. Phoenix is not in the business of providing a component library to users. core_components is the smallest subset of components, which phoenix needs to have all its generators powered by them. If generators markup changes so will core_components.
All the stuff you’ll need even if you don’t use generators will live elsewhere, like <.link> and <.form> come from the Phoenix.Component module.
Appreciate the detailed answer. I fear that things I learn get irrelevant within short timeframes. At work I have been using Vue for example. It didn’t get any change of this magnitude within the past years that’s why I was thrown off.
Surely it’s easy to see what needs to get refactored, given one has experience. It’s a whole different story for people that learn and barely know how the framework works. I just already committed a lot of time in learning Elixir and I don’t want that time to be wasted because everything changes every few weeks in a framework I use.
Having to relearn my whole web development experience because I’m not used to how templating works is a long road.
Again these changes only affect newly generated phoenix projects. While learning I’d suggest sticking with the version you’re currently on, make sure you understand that one. Afterwards changes like the above will look way less taunting. There’s no need to follow with active development while you’re trying to understand the code you already got in front of you.