A new redux-based DDP client


#1

Hi,

I would like to announce a project I’ve been working on for the past couple of months:

It’s a completely new DDP client that should work out of the box with any React application and any kind build tool for both browser and react-native.

The api is fully declarative, inspired by ApolloClient to some extent, but it does not offer any of the GraphQL goodies. Instead it relies on the standard DDP features - you can either request your data via subscriptions or methods. This means that the client can be connected to any DDP server, not requiring any modifications to the server code.

The project is still in alpha stage so please do not expect production quality yet and the api changes should still be expected. I would be very grateful for any comments/ suggestions/ bug reports.

Cheers,
Tomasz


#2

This looks strange:

    todoList: from('TodoLists').select.one('listId'),
    todos: from('Todos').select.where(
      createSelector(
        prop('listId'),
        listId => todo => todo.listId === listId,
      ),
    ),

Take a look here: https://www.npmjs.com/package/sift

todos: ({Todos}) => sift(Todos, {listId});

Other than that, very interesting approach, curious to see where it takes you.


#3

@diaconutheodor Thanks for this comment.

I agree that the current syntax is far from being perfect. This is actually one of the areas which I am planning to re-think from scratch so all new ideas are more than welcome.

Personally I was thinking about something like:

todoList: from('TodoLists').selectOne('listId')
todos: from('Todos').select({ listId: prop('listId') })

The difficulty, which I am struggling with comes from the fact that “selectors” themselves are usually a function of component props (e.g. the listId above), so they also need to be selected if we want some kind of caching to work properly.