Start a new topic

Kinvey Studio update

Hi, I just updated Kinvey Studio and been trying to update my code to work with the latest Kinvey Studio frame work. I use to have a snippet of code to keep one record in a view and update that record with user settings. 

I just want to load one record in the view and keep edit this record.

The way I use to hold that record was : 

this.usersService.dataState.onChanges(of({id: userId}));

With this new version of Kinvey Studio this throws an error:

// Argument of type 'Observable<{ id: string; }>' is not assignable to parameter of type 'Observable<StateReducer<EntityState>>'.
// Type '{ id: string; }' is not assignable to type 'StateReducer<EntityState>'.
// Type '{ id: string; }' provides no match for the signature '(state: EntityState): EntityState'.

I have tried this: 

this.usersService.dataState.onChanges(findEntity(this.usersService.dataChanges, '_id'), userId);

But this adds new records to the collection and I just like to update the one record that belongs to the current logged in user.


1 Comment

Hello Thomas,

If I am not mistaken, you should have already received an answer to this question through a separate channel. Still, I would share the resolution here as it might help someone else that encounters such issue.

To resolve this issue, you need to use this.usersService.dataState.onChanges(of(() => ({ id: userId }))); instead of this.usersService.dataState.onChanges(of({id: userId}));.



Login or Signup to post a comment