@quesmed/types-rn 2.2.97 → 2.2.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -24,6 +24,7 @@ export interface ISaveTodosVar {
|
|
|
24
24
|
todos: ITodoInput[];
|
|
25
25
|
}
|
|
26
26
|
export declare type ISaveTodosData = RestrictedData<(graphqlNormalize & ITodo)[], 'saveTodos'>;
|
|
27
|
+
export declare const optimisticUpdatedSaveTodo: (todo: ITodo, cardIndex: number, todoInput: ITodoInput) => ISaveTodosData;
|
|
27
28
|
export declare function saveTodosCache(cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<ISaveTodosData>, options: ApolloUpdateOptions): void;
|
|
28
29
|
export declare const optimisticSaveTodos: (todo: ITodo, cardIndex: number, todoInput: ITodoInput) => ISaveTodosData;
|
|
29
30
|
export declare const ADD_TO_DAILY_STACK: import("@apollo/client").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REFRESH_DAILY_TASK = exports.updateCacheOnAddToDailyStack = exports.updateCacheOnRemoveFromDailyStack = exports.REMOVE_FROM_DAILY_STACK = exports.ADD_TO_DAILY_STACK = exports.optimisticSaveTodos = exports.saveTodosCache = exports.SAVE_TODO = exports.BUILD_TODO = void 0;
|
|
3
|
+
exports.REFRESH_DAILY_TASK = exports.updateCacheOnAddToDailyStack = exports.updateCacheOnRemoveFromDailyStack = exports.REMOVE_FROM_DAILY_STACK = exports.ADD_TO_DAILY_STACK = exports.optimisticSaveTodos = exports.saveTodosCache = exports.optimisticUpdatedSaveTodo = exports.SAVE_TODO = exports.BUILD_TODO = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
5
|
const fragments_1 = require("../../fragments");
|
|
6
6
|
const restricted_1 = require("../../query/restricted");
|
|
@@ -55,6 +55,23 @@ exports.SAVE_TODO = (0, client_1.gql) `
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
`;
|
|
58
|
+
const optimisticUpdatedSaveTodo = (todo, cardIndex, todoInput) => {
|
|
59
|
+
const { score, timeTaken } = todoInput;
|
|
60
|
+
const { marks } = todo;
|
|
61
|
+
const newMarks = [...marks];
|
|
62
|
+
newMarks[cardIndex] = { ...marks[cardIndex], score, timeTaken };
|
|
63
|
+
return {
|
|
64
|
+
restricted: {
|
|
65
|
+
saveTodos: [
|
|
66
|
+
{
|
|
67
|
+
...todo,
|
|
68
|
+
marks: newMarks,
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
exports.optimisticUpdatedSaveTodo = optimisticUpdatedSaveTodo;
|
|
58
75
|
function saveTodosCache(cache, result, options) {
|
|
59
76
|
const { saveTodos } = result?.data?.restricted || {};
|
|
60
77
|
if (!options.variables || !saveTodos) {
|