-
-
Notifications
You must be signed in to change notification settings - Fork 754
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
Patching entity through service causes the socket entity to be wrongly updated #1049
Comments
If I am not wrong about this issue the proposed patch is to still call the |
Hopefully no need to learn Lerna, |
Would still be nice to get some of this maybe sorted out before. #991 is probably related to this as well. |
I wonder about one thing with lerna, if I do a fork of feathers to patch eg the authentication module, then submit a PR, then how can I use my fork in my app waiting for the release ? Previously I could point my |
I ran into issues with the new lerna repo. First Second the tests seems to halt without exiting after running those at root level, tests in subdirectories are not executed. I am running Node.js 8.9 under Windows 10, this might be linked. For now I propose to PR against the old repo, I can PR here as well but I cannot run the tests for now. |
@claustres Can you try by wrapping the path in quottes ?
|
@bertho-zero just tested and it does not work , what works is:
I guess previously we had something like:
with the package installed locally, which allowed to directly call mocha. Don't know how to make it work cross-platform. |
And by adding the
|
Result:
Correct me if I am wrong but the The problem seems to be related to command path with slash under Windows. If I add mocha as a dev dependency of the package then this works:
However I do not know lerna enough to see if this can cause a problem to add mocha in each package. |
Ah sorry about that, I haven't gotten a chance to test this on Windows yet. I think #1051 should help with this problem. |
Both Lerna's interest is to have only one system for testing, linting, and so on. Mocha is installed once on root and reused in packages. The ideal in a monorepo would be to use |
Yes that's exactly what I tested fine but I don't know how it works with lerna to ensure you have a "shared" mocha between all packages. |
@claustres Can you try again with latest master. It should install the mocha binary for your operating system and run without needing the folder separator. |
I ran into another issue caused by the entity update and by using MongoDB with feathers-sync. When the socket initializes the user is retrieved from the DB and his id property is an ObjectID. Then if the user is patched, because event data are serialized in MongoDB when using feathers-sync, his id becomes a string after the entity update. This causes any subsequent operation based on the id to fail in MongoDB. I wonder if it would not be better to ignore the id on entity update or to make the update function customizable to handle the various possible business cases. I also wonder more generally about listening to events with feathers-sync and similar issues. Indeed, in this case the events all go through the serialization process, even on the initiator server. By serializing event data each server listening to events receives "client-like data" so that we should apply any relevant conversion functions like services do with hooks (eg for ObjectIDs, Dates, etc.) to ensure consistency. Let me know if it is already possible to do something with respect to this using the current Feathers or what you think about that for future improvements. |
@daffl Sorry for the delay, I've just tested your changes and now the tests run fine, thanks. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs. |
Steps to reproduce
Authenticate a user which data model has two properties
email
andname
. Patch one of the property likeapp.service('users').patch(id, { name: 'xxx' })
. After patch the user entity attached to the socket has lost theemail
property. It will cause any hook or operation depending on it to stop working on next service call.Expected behavior
The socket entity should be correctly patched.
Actual behavior
The socket entity is updated instead of being patched.
This code could be the problem since the same function is called for both update or patch operations and this function delete properties based on the input object.
System configuration
Module versions:
NodeJS version: 8
Operating System: Windows
The text was updated successfully, but these errors were encountered: