How to use the re-reselect.default function in re-reselect

To help you get started, we’ve selected a few re-reselect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Rediker-Software / redux-data-service / dist / Services / DataService.js View on Github external
DataService.prototype.createSelectors = function () {
        var selectors = _super.prototype.createSelectors.call(this);
        var getServiceState = selectors.getServiceState;
        var getAllItems = reselect_1.createSelector(getServiceState, function (store) { return store.items; });
        var getRequestCache = re_reselect_1.default(getServiceState, function (state, queryParams) { return queryParams; }, function (store, queryParams) { return store.requestCache.get(hash(queryParams || {})); })(function (state, queryParams) { return hash(queryParams || {}); });
        var getItems = re_reselect_1.default(getAllItems, function (state, queryParams) { return getRequestCache(state, queryParams); }, function (items, requestCache) { return requestCache ? requestCache.ids.map(function (id) { return items.get(id); }).valueSeq() : null; })(function (state, queryParams) { return hash(queryParams || {}); });
        var getItemsByIds = re_reselect_1.default(function (state, ids) { return ids; }, getAllItems, function (ids, items) {
            return ids
                .map(function (id) { return items.get(id); })
                .filter(function (item) { return item != null; });
        })(function (state, ids) { return JSON.stringify(ids.sort()); });
        var getItem = re_reselect_1.default(getAllItems, function (state, id) { return id; }, function (items, id) { return items.get(id); })(function (state, id) { return id; });
        return __assign({}, selectors, { getAllItems: getAllItems,
            getItem: getItem,
            getItems: getItems,
            getItemsByIds: getItemsByIds,
            getRequestCache: getRequestCache });
    };
    DataService.prototype.createReducers = function () {
github Rediker-Software / redux-data-service / dist / Services / DataService.js View on Github external
DataService.prototype.createSelectors = function () {
        var selectors = _super.prototype.createSelectors.call(this);
        var getServiceState = selectors.getServiceState;
        var getAllItems = reselect_1.createSelector(getServiceState, function (store) { return store.items; });
        var getRequestCache = re_reselect_1.default(getServiceState, function (state, queryParams) { return queryParams; }, function (store, queryParams) { return store.requestCache.get(hash(queryParams || {})); })(function (state, queryParams) { return hash(queryParams || {}); });
        var getItems = re_reselect_1.default(getAllItems, function (state, queryParams) { return getRequestCache(state, queryParams); }, function (items, requestCache) { return requestCache ? requestCache.ids.map(function (id) { return items.get(id); }).valueSeq() : null; })(function (state, queryParams) { return hash(queryParams || {}); });
        var getItemsByIds = re_reselect_1.default(function (state, ids) { return ids; }, getAllItems, function (ids, items) {
            return ids
                .map(function (id) { return items.get(id); })
                .filter(function (item) { return item != null; });
        })(function (state, ids) { return JSON.stringify(ids.sort()); });
        var getItem = re_reselect_1.default(getAllItems, function (state, id) { return id; }, function (items, id) { return items.get(id); })(function (state, id) { return id; });
        return __assign({}, selectors, { getAllItems: getAllItems,
            getItem: getItem,
            getItems: getItems,
            getItemsByIds: getItemsByIds,
            getRequestCache: getRequestCache });
    };
    DataService.prototype.createReducers = function () {
github Rediker-Software / redux-data-service / dist / Services / DataService.js View on Github external
DataService.prototype.createSelectors = function () {
        var selectors = _super.prototype.createSelectors.call(this);
        var getServiceState = selectors.getServiceState;
        var getAllItems = reselect_1.createSelector(getServiceState, function (store) { return store.items; });
        var getRequestCache = re_reselect_1.default(getServiceState, function (state, queryParams) { return queryParams; }, function (store, queryParams) { return store.requestCache.get(hash(queryParams || {})); })(function (state, queryParams) { return hash(queryParams || {}); });
        var getItems = re_reselect_1.default(getAllItems, function (state, queryParams) { return getRequestCache(state, queryParams); }, function (items, requestCache) { return requestCache ? requestCache.ids.map(function (id) { return items.get(id); }).valueSeq() : null; })(function (state, queryParams) { return hash(queryParams || {}); });
        var getItemsByIds = re_reselect_1.default(function (state, ids) { return ids; }, getAllItems, function (ids, items) {
            return ids
                .map(function (id) { return items.get(id); })
                .filter(function (item) { return item != null; });
        })(function (state, ids) { return JSON.stringify(ids.sort()); });
        var getItem = re_reselect_1.default(getAllItems, function (state, id) { return id; }, function (items, id) { return items.get(id); })(function (state, id) { return id; });
        return __assign({}, selectors, { getAllItems: getAllItems,
            getItem: getItem,
            getItems: getItems,
            getItemsByIds: getItemsByIds,
            getRequestCache: getRequestCache });
    };
    DataService.prototype.createReducers = function () {

re-reselect

Enhance Reselect selectors with deeper memoization and cache management

MIT
Latest version published 9 months ago

Package Health Score

76 / 100
Full package analysis