How significant is Jets 2.x?

question

#1

Before I upgrade to 2.x, I just wanted to know if there were any breaking changes from 1.9.x. Thanks!


#2

It’s significant in terms of features because of Routing Improvements. But in terms of breaking changes, there are not too many. The jets upgrade command should address those. Think a good approach is taking a look at the Upgrading Guide.

https://rubyonjets.com/docs/extras/upgrading/

And see if those highlighted changes may affect you. You may also want to try a deploy with the JETS_ENV_EXTRA feature.

https://rubyonjets.com/docs/env-extra/


#3

I’ve noticed that my deploy command started failing after 2.x update. I have not had chance to recreate using a small example but that is my plan for the weekend.
Keep in mind that jets routes or jets server did not fail, only failed when using jets deploy.


#4

Ok. Interested in the reproduction. Thanks.


#5

Error message: The jets application contain invalid routes.
Sorry, I know this isn’t much helpful, I’ll create a sample repo soon.


#6

All good. Thanks for taking the time to post the error message.


#7

Got an example. Has to do with namespace.

Check this PR link: https://github.com/ratneshraval/serializer-jets/pull/2


#8

Looks like the correct usage is prefix here. Namespace usage will have to match with folder path as well.
This may be an error on my side because this used to work in 1.9.x
Seems like just part of adjustments needed for 2.x update


#9

Thank so much for the example project! :tada:

You beat me to it. Yup. That’s what’s going on.

One of the reasons why there wasn’t documentation on the namespace method in jets 1.x was because I was unsure how namespace was going to work. Was hoping not a lot of folks were using it yet. But you were already

After studying how Rails namespace works more thoroughly. Updated Jets namespace to more closely resemble Rails behavior. You figured it out already though.:grin:

For posterity and others, if you’re using namespace in jets 1.x then you’ll need to switch to prefix in jets 2.x. So, from:

  namespace 'nmsp' do
    get 'sample', to: 'sample#index'
  end

To:

  prefix 'nmsp' do
    get 'sample', to: 'sample#index'
  end

That will mimic the old behavior if you that’s what you desire.

Updated the Jets upgrade guide to note this: Jets Upgrading Guide

That being said, updated the jets routes command to check for invalid routes to add another way to find out before deployment: https://github.com/tongueroo/jets/pull/355