Version 8.3.0 release! #6787
Pinned
na9da
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Introduction
Today we are releasing Terriajs version
8.3.0
which includes a few breaking changes:4.9.x
6.9.x
👉 This might affect your map only if it has local model layer modifications like your own custom data provider (aka catalog items). Otherwise you can proceed like any other normal upgrade.
The rest of this post describes steps to upgrade your terriamap with local model layer modifications to terriajs version
8.3.0
and how to address some of the issue that might come up.If you have any difficulty upgrading your application please feel free to use this thread or create a new discussion topic and our team will respond to it.
Upgrading a fork of terriamap with custom model layer changes
Basic steps
package.json
and make sure the version ofterriajs
is at least8.3.0
.yarn run gulp sync-terriajs-dependencies
from the command line.This synchronizes the dependencies of your map with that of
terriajs
libraryyarn install
to install the new dependencies.yarn run gulp build
to build the updated application.Do a quick scan of the build log for any typescript errors
yarn run start
to start your local server.http://localhost:3001
in your browser to view the application.🎉 🚀 If all goes well, you should be able to see your app and add your datasets to the workbench without errors. If that's the case you can ignore the rest of this document.
🥼 Advanced scenario
After following the basic steps above and opening terriamap application in browser, if you see a blank screen instead of the app, chances are that you might need to update your local code modifications to make it consistent with mobx 6 changes.
💡 One way to discover the error causing the blank page is to use Firefox devtools with pause-on-exception option enabled like in the below screenshot. Then you can try and fix each issue one-by-one till your app loads succesfully.
🔧 Upgrading your local code changes to Mobx 6
Mobx has a detailed migration guide for upgrading to mobx 6 API which explains why this change is required. Please refer to it before reading the remaining sections.
To migrate your local code to mobx 6 we recommend you follow the below steps:
Run
npx mobx-undecorate --keepDecorators --dir=lib/
This will modify your local code inside the
lib/
directory to make it consistent with mobx 6 changes.Run
git diff
to view the changes made by the upgrade script.The script might make the following changes to your code:
If your
class
es use mobx decorators like@observable
,@computed
or@action
. It will add a linemakeObservable(this)
to theconstructor
of your class.If your
class
does not already define aconstructor
, then it generates one and inserts a call tomakeObservable(this)
.👉 Note: When
mobx-undecorate
makes this change, it cannot automatically determine the parameters of yourconstructor
. So it'll generate a// TODO: [mobx-undecorate] verify the constructor arguments and the arguments of this automatically generated super call
in your constructor. You'll have to check and make sure theconstructor
has the correct parameters in its signature and is also passing the correct arguments to thesuper()
call.If your class is a terriajs Catalog item. Then you will most like need to change the
constructor
as:Rebuild and reload your app in browser
Other upgrade issues
Fixing re-decoration of overridden methods
If you are overriding terria model layer methods like
selectableDimensions
that already have a mobx decoration or sometrait
value, you will need to use the new mobx@override
decorator when overriding them. The@override
decorator should be used in place of@observable
,@computed
or@action
. Note that@override
should only be used when overriding an existing mobx decorated method.Example mobx error for this issue:
Fixing duplicate Mixin inheritance issues
You'll need these changes only if you have used mixins like
TableMixin
in your custom code.TableMixin
already inherits fromCatalogMemberMixin
andMappableMixin
. So you will need to remove these Mixins from your CatalogItem if you are explicitly adding them.Example mobx error for this issue:
Beta Was this translation helpful? Give feedback.
All reactions