-
Notifications
You must be signed in to change notification settings - Fork 23
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
serviceName.on does not work #30
Comments
It does not use the same signature as * An action creator for listening on service events is returned as { on } and could be used like:
import feathersApp, { services } from './feathers';
feathersApp.service('messages').on('created', data => {
store.dispatch(
services.messages.on('created', data, (event, data, dispatch, getState) => {
// handle data change
})
);
}); I'd appreciated knowing how you used it if you succeed. |
Hey there, thanks for providing this module. It is definitely an awesome abstraction when using both feathers and redux together. I also came across this issue when attempting to listen for real time service updates and updating the redux store accordingly. The way I was achieving this initially this was something similar to:
The code above is essentially dispatching the find action for the respective service whenever the .on() event is executed. This was fine initially but when there is more data for the services then I believe it isn't efficient because you are only running the find() action to retrieve the newly updated data but you're retrieving ALL of the data along with the updated one. Afterwards, I created a new action/reducer to update the service state accordingly. Something along the lines of this:
Action type:
Action creator:
Reducer:
The code seems to work fine although I have only tested/used it for a day. The components that are listening for the respective service state changes update accordingly when new data is added. If there is a better way to achieve this, please comment below. |
Some of the still outstanding issues make it clear that many use cases are not best handled by the 3 stores (find, non-find, replication) within the feathers-redux store. I won't have time to take a deep dive into these issues before sometime Jan 2018. In the meantime, perhaps you can consider making a PR to address what you pointed out above. |
Sounds good. I will try to make the PR as soon as possible. I should get around to it within next couple days. Thanks @eddyystop. |
@eddyystop, Created the PR here (#37). Please let me know if I am missing something. |
@eddyystop, Any updates on this? I can add to the docs if this is merged also. Are there any issues? |
Oops, sorry. I got lost doing the Buzzard common hooks docs. I'll check it out Sunday. BTW, https://feathers-plus.github.io/v1/feathers-hooks-common/index.html |
@eddyystop, The docs look awesome. Looks similar to VueJS docs. Keep up the great work. |
I cloned from VueJS. :)
…On Sun, Nov 19, 2017 at 9:58 PM, bsubedi26 ***@***.***> wrote:
@eddyystop <https://github.com/eddyystop>, The docs look awesome. Looks
similar to VueJS docs. Keep up the great work.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#30 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABezn4u7Yzh0ZUAei9XDATSEB79-0bnqks5s4OrcgaJpZM4PEFBH>
.
|
When I trying use
I getting error "TypeError: Cannot read property 'concat' of undefined" in
Does this functionality work? |
Hi everyone. |
Steps to reproduce
(First please check that this issue is not already solved as described
here)
The 'on' events don't seem to work using reduxified services.
Expected behavior
Tell us what should happen
When doing
I am expecting the callback function to be triggered.
Actual behavior
However, nothing happens.
However, if I do
However, if I do:
It works.
System configuration
Tell us about the applicable parts of your setup.
Module versions (especially the part that's not working):
"feathers-client": "^2.3.0",
"feathers-redux-immutable": "^0.1.0",
"redux": "^3.7.2",
NodeJS version:
v8.1.4
Operating System:
Mac OS
Browser Version:
Chrome 60.0.3112.101
@eddyystop any ideas to what I could be doing wrong? I did not see an example of this unfortunately so I expected it to work similarly to regular service calls.
The text was updated successfully, but these errors were encountered: