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

chore(all): convert to TS #374

Merged
merged 31 commits into from
Apr 28, 2019
Merged

Conversation

bigopon
Copy link
Member

@bigopon bigopon commented Apr 23, 2019

Beside conversion, also add ability to configure Compose behavior to not inherit binding context by default via entry configure function:

export function configure(config: any, { useLegacyBehavior = true } = {}); {
  Compose.useLegacyBehavior = useLegacyBehavior;
}

It's based on @jdanyow 's comment here #222 (comment)

Though I'm not sure when Compose is configured to not inherit binding context, it should throw or just silently inherit when composed with view only instruction.

Besides that, adjust build, so now distribution will be a single file with sourcemap enabled. Something like this
image

@EisenbergEffect @jdanyow @jods4 @fkleuver

@fkleuver What should i adjust circle CI of this to?

@huochunpeng
resolves #332
resolves #300
resolves #321

@EisenbergEffect
Copy link
Contributor

Wow! @bigopon You are a beast! This is awesome. How should we proceed. I'm not sure if I have a ton of time to review every line. I trust your work though :) Is there anything in particular we should look at, any concerns, details left to polish up?

@bigopon
Copy link
Member Author

bigopon commented Apr 24, 2019

@EisenbergEffect The plan is like this:

in templating-router and templating-resources, accept 2nd paramter for configure function to toggle legacy behavior for Compose and RouterView.

in framework, add method enableLegacyBehavior(enabled: boolean) to FrameworkConfiguration to pass that to those two modules.

Write some doc for this.

Details to look at:

There are two way to toggle Compose behavior:

  • at start up time: like explained above
  • at any time: Compose.useLegacyBehavior = true/false (default is true for compat). I'm not sure about naming.

@bigopon
Copy link
Member Author

bigopon commented Apr 24, 2019

About the conversion, it's not that much of a big deal I think. Most typings are still kept any for safety reasons. Mostly it's the build/tests/development flow that are cleaner now

@EisenbergEffect
Copy link
Contributor

@bigopon Instead of using the generic terms "legacy behavior" can we instead make the property name more explicit in what it's doing? For example allowParentScopeTraversal = true or something like that. Not sure exactly what the name would be.

@bigopon
Copy link
Member Author

bigopon commented Apr 24, 2019

@EisenbergEffect that sounds good to me. Will need to adjust router view accordingly. What about view only composition, do we want to auto traverse parent, or throw?

@EisenbergEffect
Copy link
Contributor

For view-only composition, remind me what happens with the binding context. Does it get nothing if it doesn't traverse? That doesn't seem right. Is there a reason we would treat this scenario differently?

@bigopon
Copy link
Member Author

bigopon commented Apr 24, 2019

It points to the Compose element with its overrideContext https://github.com/aurelia/templating-resources/blob/6aa889b2f8aa92ca6a9b8acb3a0ba4bdca7372d7/src/compose.ts#L227L228

Which I think it will automatically inherit owning view of compose by default. So only need some tests, no need to change anything here

@EisenbergEffect
Copy link
Contributor

If it inherits the owning view, that sounds ideal.

@bigopon
Copy link
Member Author

bigopon commented Apr 24, 2019

@EisenbergEffect here are the two skipped tests

I just realized when adding some integration tests for compose, that <router-view/> and <compose/> do composition differently. <router-view/> controls the behavior instruction, while <compose/> does not.

For this, I think I'll have to add something in templating.

@EisenbergEffect
Copy link
Contributor

@bigopon I'd rather just delete the code than comment it out usually. Was there a strong argument for doing it this way?

@bigopon
Copy link
Member Author

bigopon commented Apr 28, 2019

@EisenbergEffect Removed

@bigopon
Copy link
Member Author

bigopon commented Apr 28, 2019

@EisenbergEffect one of throttle tests is failing, its' probably non-deterministic timing related, we can fix that later.

@EisenbergEffect EisenbergEffect merged commit ae5c1a2 into aurelia:master Apr 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants