Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime): use bootstrap mechanism to load globals rather than setting in the alloy.js file #964

Merged
merged 2 commits into from
Aug 6, 2020

Conversation

ewanharris
Copy link
Contributor

Fixes ALOY-1734

  • alloy.bootstrap.js will be loaded at startup before the app.js, this ensures that the globals are correctly configured before the app.js is even executed.
  • Check if the globals exist in the app.js and set them if they don't, this should keep us compatible with SDKs pre-7.5.0 (i.e. those without the bootstrap feature, if you're using an SDK that old ... please, please, please update ASAP)

Test steps - see jira

@build
Copy link

build commented Aug 5, 2020

Warnings
⚠️

Please ensure to add a changelog entry for your changes. Edit the CHANGELOG.md file and add your change under the Unreleased items header

Messages
📖

✅ All tests are passing
Nice one! All 3490 tests are passing.

Generated by 🚫 dangerJS against efcabf6

Copy link
Contributor

@jquick-axway jquick-axway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks for taking care of this @ewanharris !

@ewanharris ewanharris merged commit 794520f into tidev:master Aug 6, 2020
@ewanharris ewanharris deleted the ALOY-1734 branch August 6, 2020 09:27
@brentonhouse
Copy link
Contributor

@ewanharris @jquick-axway - I know you have already merged this but I've tried using bootstrap files for assigning globals in the past and although it works when running normally, it breaks everything when running in LiveView.

@jquick-axway
Copy link
Contributor

jquick-axway commented Aug 8, 2020

@brentonhouse, I'm not sure how it could fail. When you make a file change, LiveView invokes Titanium's undocumented Ti.App._restart() method, which then reloads our "ti.main.js" script, which in turn loads all of our bootstrap scripts before requiring-in the "app.js". I've tested Android with hyperloop (which now uses a bootstrap script and binding APIs) and it restarts with LiveView fine for me.

But it doesn't hurt to re-test Alloy and LiveView again anyways. It's part of our smoke test anyways.

@brentonhouse
Copy link
Contributor

What happens is there becomes multiple instances of modules. If you set a property on a module in alloy.js and go to read it in index.js, the property is not set as it is a clean instance of the module.

1 similar comment
@brentonhouse
Copy link
Contributor

What happens is there becomes multiple instances of modules. If you set a property on a module in alloy.js and go to read it in index.js, the property is not set as it is a clean instance of the module.

@brentonhouse
Copy link
Contributor

We saw this before but I think it was fixed by this #955

@ewanharris
Copy link
Contributor Author

@brentonhouse I'm unaware of any issues between alloy and the boostrap mechanism, I know we've seen issues similar to what you're describing (TIMOB-27206), but that was specifically down to liveview and it's inability to handle node_modules.

Do you have

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants