relay icon indicating copy to clipboard operation
relay copied to clipboard

paginationContainer: refetchConnection is missing

Open Rick83600 opened this issue 9 years ago • 1 comments

Hello guys, sorry if this issue is already posted.

In the docs we have :

/**
 * Refetch the items in the connection (with potentially new variables).
 */
refetchConnection:(
  totalCount: number,
  callback: (error: ?Error) => void,
  refetchVariables: ?Variables,
) => ?Disposable,

But in this method doesn't seems to work. Coz in the transpiled code we don't have "refetchVariables"

      _this._refetchConnection = function (totalCount, callback) {
        var paginatingVariables = {
          count: totalCount,
          cursor: null,
          totalCount: totalCount
        };
        return _this._fetchPage(paginatingVariables, callback, { force: true });
      };

So if I understand, we have to wrap a paginationContainer in a refetchContainer ?

:)

Rick83600 avatar Jul 10 '17 08:07 Rick83600

So I found a solution,

In the transpiled code of relay we don't have the last arguments who is the refetchVariables: ?Variables.

So I clone the relay repo, I build the project myself and finally I replace the ReactRelayPaginationContainer.js newly builded.

And the refetchConnection method work perfectly, I can use a pagination container with refetch and pagination.

I use "react-relay": "^1.1.0" in my package.json

Rick83600 avatar Jul 11 '17 14:07 Rick83600