-
Notifications
You must be signed in to change notification settings - Fork 46
Migrating from v5.x to v6.x
Whenever you used a UIComponent directly (not using an AngularJS Directive) the syntax was similar to this:
<button ts-button ts.specialThing="fourtytwo" class="ts-primary">Touch me</button>The new syntax is like this:
<button data-ts="Button" data-ts.specialThing="fourtytwo" class="ts-primary">Touch me</button>So here are the rules of what is happening:
ts-xxx becomes data-ts="Xxx"
ts-xxx-yyy becomes data-ts="XxxYyy"
ts.zzz="aaa" becomes data-ts.zzz="aaa"
ts.zzzWww="aaa" becomes data-ts.zzzWww="aaa"
The following classes have also been renamed:
-
ts-main-contentbecomests-maincontent -
ts-groupbecomests-fieldset
This is happening so that the class can always be predicted from the name of the component (data-ts="FieldSet" -> ts-fieldset, data-ts="MainContent" -> ts-maincontent)
Short answer: React compatibility.
Long answer: When react parses the templates it only accepts totally valid (X)HTML, so our ts-xxx attributes were rejected. We tried looking into patching JSX so we can use our own tags but these accepted attributes are hardcoded in several different places in the React codebase, and we couldn't find a nice maintainable way of "fixing" it so we opted to change our markup.
This also means that now code using Tradeshift UI will be 100% valid (X)HTML which will probably help us down the road.
We decided not to change the existing AngularJS Directives we have in place for 2 reasons:
- Let's not change any more syntax than we have to
- It's clearly visible now which calls are using UIComponents directly and which are going through directives, which will help with debugging code.
Here is a list of all the components/features that are running through Directives:
ts-component-factoryts-input-validatorts-file-on-change<aside />ts-company-cardts-sidebarts-topbarts-userimagets-pager
We are already working on a big search & replace operation in the whole Apps repo, you can find the PR here: https://github.com/Tradeshift/Apps/pull/3213
And the Apps-Server PR is here: https://github.com/Tradeshift/Apps-Server/pull/286
Once we're finished, tests are green and we like what we see, we'll deploy all of this to a sandbox and we'll need your help to test your apps manually. Stay tuned!
Thanks,
The Tradeshift UI Team
As always, don't forget to check the Issues and Releases pages for the most up-to-date info.
| The Docs | Issues Page | Releases Page | Repo Readme | Check out the Milestones |
|---|