-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix named-register.js - omit name from register call. Resolves #2293. #2329
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
Conversation
File size impactMerging issue-2293 into master will impact 1 file in 1 group. browser (0/2)No impact on files in browser group. node (0/1)No impact on files in node group. extras (1/8)
|
src/extras/named-register.js
Outdated
| }); | ||
| } | ||
| return register.apply(this, arguments); | ||
| return register.apply(deps, declare); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be:
return register.apply(this, [deps, declare]);I don't know how to reproduce the issue in the unit tests, but here's a repro with the above fix:
https://codesandbox.io/s/broken-sun-c3xjm?file=/index.html
See the named-register-fixed.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good catch, I thought I had tested this but now that I see the problem I wonder why my testing wouldn't have noticed that it wasn't correct.
I've updated it now.
guybedford
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this! Is it possible to get a test to cover this case?
Not without some reworking of the tests - currently the amd.js extra is executed before the named-register extra, which alters behavior in such a way that the test would pass both with and without the new code. |
|
FYI, this appears to be a breaking change with respect to previous behavior. After updating to 6.9.0, Then later The above worked as expected with version 6.8.x and the named-register/amd extras. See this sandbox that demonstrates the issue. You'll need to comment/uncomment the script elements as necessary to switch between SystemJS versions. https://codesandbox.io/s/epic-goldstine-r1qio?file=/index.html |
…js#2293. (systemjs#2329) * Fix named-register.js - omit name from register call. Resolves systemjs#2293. * Feedback
…js#2293. (systemjs#2329) (#1) * Fix named-register.js - omit name from register call. Resolves systemjs#2293. * Feedback Co-authored-by: Joel Denning <[email protected]>
See #2327 (comment) and #2293. cc @anhallbe who found the problem.
System core expects to never be called with the string name as the first argument, but named-register does so. The reason the tests pass and named-register works for some people is that named-register overrides
getRegisterto retrieve fromregisterRegistryfor named registers. However, when that doesn't happen, thelastRegisterin system core is just incorrect!