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

Return result directly from findPath with enableSync() #54

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

PSeitz
Copy link

@PSeitz PSeitz commented Oct 8, 2017

No description provided.

@PSeitz PSeitz changed the title Return data directly from findPath with enableSync() Return result directly from findPath with enableSync() Oct 8, 2017
@prettymuchbryce
Copy link
Owner

prettymuchbryce commented Oct 8, 2017

I appreciate the change, but I'm not sure I will merge this. I think I prefer the API to be consistent in both the sync and async cases even if it's a little less convenient.

One option would be to follow the node standard modules convention in creating a findPathSync which has this behavior, but it seems unnecessary given we already have the existing configuration option, and may just be more confusion than it's worth.

@PSeitz
Copy link
Author

PSeitz commented Oct 9, 2017

From the API perspective sync calls usually return values, only async operations require functions callbacks, but I agree both mangled in this function is not great.

A new function may be the best way. I would remove enableSync as configuration and just provide findPathSync since enableSync and a callback is confusing.

@prettymuchbryce
Copy link
Owner

I think it makes sense to add the findPathSync and deprecate the enableSync option, but we can't just remove it outright otherwise we will break backwards compatibility.

@mikedevelops
Copy link

mikedevelops commented Apr 11, 2018

@prettymuchbryce Firstly, thank you for creating this great library, really impressive work.

I agree that the implementation of findPathSync would be a valuable iteration to the current enableSync method. I'm in a situation where I need to manage multiple co-dependant paths, so right now (although possible) the thought of handling them asynchronously and dealing potential race conditions (or having to manage synchronous callbacks) is putting me off.

Is there any update on this PR? It'd be great to get this in master. If there's anything I can do to help, I'm more than happy to contribute.

@prettymuchbryce
Copy link
Owner

@mikedevelops I understand your concerns. I think the proposal in this PR makes a lot of sense. If you are interested in contributing, I think this would be a good candidate for a first PR.

This PR is nearly completed. In my mind I see only a few remaining tasks.

  1. Restore the enableSync option that was deleted as part of this PR. We can't remove it, because we want to retain backwards compatibility so we don't break people's projects.
  2. Write some unit tests for findPathSync.
  3. Optional, but I'm noticing we don't currently have tests for enableSync, so writing a test or two for that to ensure it still works as expected after the change would be preferred.

I'm happy to answer any questions in this thread.

@mikedevelops
Copy link

Okay sounds great @prettymuchbryce, I'll aim to get that done by the weekend 😄

@mikedevelops
Copy link

@prettymuchbryce It seemed easier to create a separate PR for this, I've added findPathSync method and left all the existing functionality untouched to maintain backwards compatibility. I added those enableSync tests also 👍 .

It's open here (#62) and ready for review.

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.

None yet

3 participants