realm-react-redux
realm-react-redux copied to clipboard
listeners[i] is a not a function
SO guys, the 0.0.9 give me the TypeError: listeners[i] is not a function. Dont know why yet.
Do you have any more info like a stack trace or some example code?
is when i instantiate the realm listeners like this:
const listeners = schema.reduce((l, model) => {
l[model] = (puppies, changes) =>
InteractionManager.runAfterInteractions(() => {
const { insertions, modifications } = changes;
insertions.forEach(i => {
if (puppies[i] && puppies[i].afterCreate)
puppies[i].afterCreate(store.dispatch, store.getState);
if (puppies[i] && puppies[i].afterSave)
puppies[i].afterSave(store.dispatch, store.getState);
});
modifications.forEach(i => {
if (puppies[i] && puppies[i].afterUpdate)
puppies[i].afterUpdate(store.dispatch, store.getState);
if (puppies[i] && puppies[i].afterSave)
puppies[i].afterSave(store.dispatch, store.getState);
});
});
return l;
}, {});
If the crash occurs on listeners[i]
then we'd need to see what the listeners
object actually looks like after instantiation as well as the value of i
when this happens. What is schema
in this case?
If you downgrade to 0.0.8 does this work?
If you can set up a small example that reproduces the issue I can run it locally myself to try and find the root cause.