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

Already on GitHub? Sign in to your account

Unable to dynamically append paths in curl 0.7.2 #146

Closed
dizzib opened this Issue Nov 6, 2012 · 5 comments

Comments

Projects
None yet
2 participants

dizzib commented Nov 6, 2012

In curl 0.6.2 I'm able to update curl paths at runtime like so:

cfg.paths.foo = '/bar'
curl cfg

This no longer works in 0.7.2, neither does the following suggestion from #143:

curl { paths: { foo: "/bar" } }

which seems to blat any existing paths, resulting in subsequent 'Syntax or http' errors.

Cheers! Andy.

dizzib commented Nov 7, 2012

Ok I think paths aren't being augmented because the Begetter only mixes in at the root level:

for (var p in mixin) child[p] = mixin[p];

So I guess I'd need to pass the new path mixed-into the original paths ? However this doesn't seem to work.

On further toying, I've discovered passing in an identical original config causes subsequent 404s:

myconfig = curl = { ... }       // setup
curl(...)                       // 1st call ok

curl(myconfig)                  // 2nd call problematic ?

Not sure if I'm missing something, ta!

Owner

unscriptable commented Nov 7, 2012

Yep. I have confirmed this bug and will fix it in the next release. -- J

On Wed, Nov 7, 2012 at 9:28 AM, Andy notifications@github.com wrote:

Ok I think paths aren't being augmented because the Begetter only mixes in
at the root level:

for (var p in mixin) child[p] = mixin[p];

So I guess I'd need to pass the new path mixed-into the original paths ?
However this doesn't seem to work.

On further toying, I've discovered passing in an identical original config
causes subsequent 404s:

myconfig = curl = { ... } // setup
curl(...) // 1st call ok

curl(myconfig) // 2nd call problematic ?

Not sure if I'm missing something, ta!


Reply to this email directly or view it on GitHubhttps://github.com/cujojs/curl/issues/146#issuecomment-10149787.

dizzib commented Nov 7, 2012

Cool, thanks!

@ghost ghost assigned unscriptable Nov 16, 2012

dizzib commented Dec 5, 2012

Hi John, thanks for fixing this issue.

Just to confirm I've got it working but only with a workaround :)

With wire 0.9.0 and curl 0.6.2 the following sequence was working:

curl
curl wire!parent
curl augmented-paths
deferred wire child relying on augmented-paths

The final step fails after upgrading to curl 0.7.3 as if it's still using the original-paths rather than augmented-paths.

My workaround is to swap the order of steps 2 & 3:

curl
curl augmented-paths
curl wire!parent
deferred wire child relying on augmented-paths

Not a big deal for me, just thought I'd mention it. Cheers!

Owner

unscriptable commented Dec 5, 2012

Ah, good point Andy!

curl effectively uses a snapshot of the config when a module is loaded. I didn't think it made much sense to change the config after a module is loaded. I think there are plenty of reasons for snapshotting (is that a word even?).

Deferred wiring is certainly a special case and one that I am sure we'll revisit again. Thanks so much for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment