PDA

View Full Version : When I should upgrade a Fiddle to version 2?



agarberi
1 Mar 2017, 7:00 AM
Hello,
when I open an old Fiddle, I change it and than I save it, it asks me if I want to upgrade it to version 2:
"Do you wish to upgrade your fiddle to use version 2?"

What changes? What are pros and cons?
In short, how can I decide if I need to upgrade or not?

Thanks,
Alessandro

mitchellsimoens
1 Mar 2017, 7:04 AM
In the Working with Files (https://docs.sencha.com/fiddle/guides/working_with_files.html) guide, the top section goes over this:


The way fiddles and the backing Ext JS framework are processed for each fiddle has been overhauled between the first iteration of Fiddle and the second. The rewriting of Fiddle’s file management serves to improve your ability to debug a running fiddle and results in a more flexible and naturalistic way of interacting with files.

Note: This guide focuses on the architectural changes in the file system at large. For specifics on working with remote data assets specifically see the Making Data Requests guide.

In Fiddle 1 your fiddle code was concatenated with the dev build of the selected Ext JS framework when running a fiddle. If you ran a fiddle in Fiddle 1 and viewed the element tab you’d see the code from any of your files from the Fiddle File System view concatenated into a script tag on the HTML page. In Fiddle 2, each file owned by the fiddle, including the default app.js file, will be delivered down to the browser as unique file requests.

The benefit of having each file delivered individually is that your code is easier to debug in the browser’s dev tools. Fiddle 2’s file delivery matches what you’d see when developing locally with unique files.

The caveat would be that with Fiddle 1 you did not have to explicitly include classes in separate files using a requires config or Ext.require(); all of your files were automatically concatenated for you. In Fiddle 2, user-added files will need to be required in order for each file / class to be loaded via the Ext JS loader just as you would in a local environment.

If you load a saved fiddle that was created with Fiddle 1, Fiddle 2 will still run the code in the concatenated means like Fiddle 1 would. When you save that fiddle, Fiddle 2 will ask if you want to upgrade it to version 2. This means it will be run in the new format where each file is expected to be required in order to load. There is also a menu item under the ‘Admin’ menu in the left toolbar to upgrade it (upgrading a fiddle to the Fiddle 2 load format is permanent).

Basically, Fiddle 1 loaded everything for you but the order of what was loaded was not always expected and was not individual file requests. Fiddle 2 only loads what you tell it to load much like you would need to do locally. So upgrading the fiddle would require you to load files using Ext JS' loader (if applicable to your fiddle).

agarberi
1 Mar 2017, 7:26 AM
Thank you very much, Mitchell, for the detailed explanation!

If possible, please, add a short description or a link to the relevant documentation in the dialog asking you to upgrade, so the user knows how to decide.