Skip to content

Conversation

@jmerrifield
Copy link
Contributor

I'd like to be able to inject pre-required modules for templateAdapter and ClientRouter so that I don't have to expose them through Browserify config, in order for Rendr to require them for me. These optional attribute values should enable that use case without breaking any existing usages.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) to 81.63% when pulling 5389789 on jmerrifield:dependency-injection into 6829ddb on rendrjs:master.

Allow the consumer to *optionally* supply an actual templateAdapter instance to
prevent Rendr from performing a dynamic require.
Allow the calling code to *optionally* supply the ClientRouter class so
Rendr doesn't attempt to require it.
@jmerrifield jmerrifield force-pushed the dependency-injection branch from 85bf359 to 1ae60e7 Compare March 23, 2015 23:43
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) to 82.81% when pulling 1ae60e7 on jmerrifield:dependency-injection into d41f3a6 on rendrjs:master.

@jmerrifield jmerrifield force-pushed the dependency-injection branch from de3d1b4 to f932400 Compare March 24, 2015 21:01
@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 82.89% when pulling f932400 on jmerrifield:dependency-injection into d41f3a6 on rendrjs:master.

@saponifi3d
Copy link
Contributor

👯

saponifi3d added a commit that referenced this pull request Mar 25, 2015
@saponifi3d saponifi3d merged commit 8909faa into rendrjs:master Mar 25, 2015
Copy link
Member

Choose a reason for hiding this comment

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

require in the browser? Looks like something very specific to browserify.

Copy link
Contributor

Choose a reason for hiding this comment

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

it was already doing this on line 13? not sure how it's terribly different from the original functionality there. (Totally agree with you though.. 😞 )

Any suggestions to fix it up? my only thought is this.modelUtils._requireAMD(defaultRouterModule) instead.

@alexindigo #454

Copy link
Member

Choose a reason for hiding this comment

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

Before it had "hardcoded" default router path, so r.js was able to augment it and with this change it makes it invisible for r.js.

Copy link
Member

Choose a reason for hiding this comment

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

Btw, looks like assign path to a variable is not essential to this change. So we might revert that particular line to the previous state. While we're thinking on better implementation.

In general IoC should make things better, but here it went sideways :)

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, balls. sorry about that guys. is the requirejs example updated so i can use it as a test bed for this stuff?

Copy link
Contributor

Choose a reason for hiding this comment

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

@saponifi3d we have this PR rendrjs/rendr-examples#15 to make it work with Rendr 1.0.1

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, that doesn't seem to fix it for me, i'm getting an error on this line https://github.com/rendrjs/rendr/blob/master/shared/base/router.js#L184 - it looks like realAction is a string not the action that is expected.

In the meantime i'm going to revert the commit that caused the breakage and push out 1.0.4 (i think it's that version?) so it's in a working state for everyone.

Copy link
Contributor

Choose a reason for hiding this comment

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

@saponifi3d just tested the sample app (05_requirejs) and it seem to be working with the latest version of Rendr 1.0.2 but we still see the require issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I haven't merged / released those changes yet for the require. I just did a fresh install and tried the example with 1.0.1 and it didn't work. Its breaking on the real action of the controller on a client-side route. Until there's a working exple there it will be hard for me to make a proper fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

The example doesn't work with 1.0.1 because we need changes from those two PR:
#448
#450

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.

5 participants