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

breaking change between 0.2.2 and 0.3.0 #3

Closed
vaughnd opened this Issue Mar 25, 2013 · 2 comments

Comments

Projects
None yet
2 participants

vaughnd commented Mar 25, 2013

Hi, got bitten by this change on upgrading to 0.3.0.

shoreleave.remotes.macros/rpc used to call the callback on success and failure, now it only calls it on success. If you've coded your error handling in your callback, it's not going to execute anymore.

Now you need (rpc remote-fn [result] :on-success success-callback :on-error error-callback).

Took a while for me to figure out that the rpc macro doesn't accept a map of callbacks like the xhr doc mentions. An example call in the docs would help.

Maybe add a CHANGES.md to keep track of backwards-incompatible api changes?

Thanks,
Vaughn

Owner

ohpauleez commented Mar 25, 2013

Thanks for the report and suggestions!

There were a few breaking changes based on: most requested features, honing and simplifying the API across all the modules, and how I saw people using the libraries in projects.

I personally liked handling all logic in a single callback, but most developers wanted something more. The new model says "success", but it should still be triggered for "complete" (IIRC) - so it completely depends how your server gives back responses.

Shoreleave-baseline is used to tease out and demonstrate all uses of the modules:
https://github.com/shoreleave/shoreleave-baseline/blob/kitchen-sink/src/baseline/client/main.cljs#L22:L34

All of the Marg docs were updated, but the README docs still need touching up. I'm still a bit swamped at the moment, but that's next on my TODO list. As always, feel free to submit patches for any piece of the project!

@ohpauleez ohpauleez closed this Mar 25, 2013

vaughnd commented Mar 26, 2013

Thanks!

I think the best behaviour would be:

  • Single callback supplied. Use old behaviour of calling on success and fail.
  • :on-success callback supplied, use new behaviour
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment