@replyke/core 5.1.6-beta.2 → 5.1.6-beta.4
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/dist/cjs/hooks/lists-redux/index.d.ts +1 -0
- package/dist/cjs/hooks/lists-redux/index.js +3 -1
- package/dist/cjs/hooks/lists-redux/index.js.map +1 -1
- package/dist/cjs/hooks/lists-redux/useIsEntitySaved.d.ts +5 -0
- package/dist/cjs/hooks/lists-redux/useIsEntitySaved.js +78 -0
- package/dist/cjs/hooks/lists-redux/useIsEntitySaved.js.map +1 -0
- package/dist/cjs/hooks/lists-redux/useListsRedux.js +6 -6
- package/dist/cjs/hooks/lists-redux/useListsRedux.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +7 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/store/slices/listsSlice.d.ts +17 -10
- package/dist/cjs/store/slices/listsSlice.js +108 -109
- package/dist/cjs/store/slices/listsSlice.js.map +1 -1
- package/dist/esm/hooks/lists-redux/index.d.ts +1 -0
- package/dist/esm/hooks/lists-redux/index.js +1 -0
- package/dist/esm/hooks/lists-redux/index.js.map +1 -1
- package/dist/esm/hooks/lists-redux/useIsEntitySaved.d.ts +5 -0
- package/dist/esm/hooks/lists-redux/useIsEntitySaved.js +73 -0
- package/dist/esm/hooks/lists-redux/useIsEntitySaved.js.map +1 -0
- package/dist/esm/hooks/lists-redux/useListsRedux.js +7 -7
- package/dist/esm/hooks/lists-redux/useListsRedux.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/store/slices/listsSlice.d.ts +17 -10
- package/dist/esm/store/slices/listsSlice.js +104 -106
- package/dist/esm/store/slices/listsSlice.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listsSlice.js","sourceRoot":"","sources":["../../../../src/store/slices/listsSlice.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"listsSlice.js","sourceRoot":"","sources":["../../../../src/store/slices/listsSlice.ts"],"names":[],"mappings":";;;;AAAA,4CAA8D;AAwB9D,gBAAgB;AAChB,IAAM,YAAY,GAAe;IAC/B,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,EAAE;IACf,aAAa,EAAE,IAAI;IACnB,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,KAAK;IACd,gBAAgB,EAAE,SAAS;CAC5B,CAAC;AAEF,mBAAmB;AACN,QAAA,UAAU,GAAG,IAAA,qBAAW,EAAC;IACpC,IAAI,EAAE,OAAO;IACb,YAAY,cAAA;IACZ,QAAQ,EAAE;QACR,kCAAkC;QAClC,iBAAiB,EAAE,UAAC,KAAK,EAAE,MAA6B;YACtD,KAAK,CAAC,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC;QAC1C,CAAC;QAED,oBAAoB;QACpB,UAAU,EAAE,UAAC,KAAK,EAAE,MAA8B;YAChD,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QACjC,CAAC;QAED,qBAAqB;QACrB,QAAQ,EAAE,UAAC,KAAK,EAAE,MAA2B;YAC3C,IAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC;YAE5B,uCAAuC;YACvC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;gBAC9B,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;YAClC,CAAC;YAED,+DAA+D;YAC/D,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;gBACxB,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAC9C,CAAC;YAED,0BAA0B;YAC1B,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC;QAChC,CAAC;QAED,MAAM,EAAE,UAAC,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wCAAwC;AACjC,IAAM,iBAAiB,GAAG,UAAC,KAA4B;IAC5D,OAAA,KAAK,CAAC,KAAK,CAAC,WAAW;AAAvB,CAAuB,CAAC;AADb,QAAA,iBAAiB,qBACJ;AAE1B,6BAA6B;AACtB,IAAM,eAAe,GAAG,UAAC,KAA4B;IAC1D,OAAA,KAAK,CAAC,KAAK,CAAC,SAAS;AAArB,CAAqB,CAAC;AADX,QAAA,eAAe,mBACJ;AAEjB,IAAM,sBAAsB,GAAG,UAAC,KAA4B;IACjE,OAAA,KAAK,CAAC,KAAK,CAAC,gBAAgB;AAA5B,CAA4B,CAAC;AADlB,QAAA,sBAAsB,0BACJ;AAE/B,mCAAmC;AAC5B,IAAM,mBAAmB,GAAG,UAAC,KAA4B;IAC9D,OAAA,KAAK,CAAC,KAAK,CAAC,aAAa;AAAzB,CAAyB,CAAC;AADf,QAAA,mBAAmB,uBACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/lists-redux/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACL,OAAO,IAAI,aAAa,GAGzB,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/lists-redux/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACL,OAAO,IAAI,aAAa,GAGzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { useCallback, useState } from "react";
|
|
38
|
+
import useAxiosPrivate from "../../config/useAxiosPrivate";
|
|
39
|
+
import useProject from "../projects/useProject";
|
|
40
|
+
import { useUserRedux } from "../auth-redux";
|
|
41
|
+
function useIsEntitySaved() {
|
|
42
|
+
var _this = this;
|
|
43
|
+
var axios = useAxiosPrivate();
|
|
44
|
+
var projectId = useProject().projectId;
|
|
45
|
+
var user = useUserRedux().user;
|
|
46
|
+
var _a = useState(null), entityIsSaved = _a[0], setEntityIsSaved = _a[1];
|
|
47
|
+
// const checkedStatus = useRef<Record<string, boolean>>({}); // Track status by entityId
|
|
48
|
+
var checkIfEntityIsSaved = useCallback(function (entityId) { return __awaiter(_this, void 0, void 0, function () {
|
|
49
|
+
var response;
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
switch (_a.label) {
|
|
52
|
+
case 0:
|
|
53
|
+
// if (!user || !entityId || checkedStatus.current[entityId]) return;
|
|
54
|
+
if (!user || !entityId)
|
|
55
|
+
return [2 /*return*/];
|
|
56
|
+
if (!projectId) {
|
|
57
|
+
throw new Error("No projectId available.");
|
|
58
|
+
}
|
|
59
|
+
return [4 /*yield*/, axios.get("/".concat(projectId, "/lists/is-entity-saved"), {
|
|
60
|
+
params: { entityId: entityId },
|
|
61
|
+
withCredentials: true,
|
|
62
|
+
})];
|
|
63
|
+
case 1:
|
|
64
|
+
response = _a.sent();
|
|
65
|
+
setEntityIsSaved(response.data);
|
|
66
|
+
return [2 /*return*/];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}); }, [user, axios, projectId]);
|
|
70
|
+
return { checkIfEntityIsSaved: checkIfEntityIsSaved, entityIsSaved: entityIsSaved };
|
|
71
|
+
}
|
|
72
|
+
export default useIsEntitySaved;
|
|
73
|
+
//# sourceMappingURL=useIsEntitySaved.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsEntitySaved.js","sourceRoot":"","sources":["../../../../src/hooks/lists-redux/useIsEntitySaved.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,SAAS,gBAAgB;IAAzB,iBAgCC;IA/BC,IAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IACxB,IAAA,SAAS,GAAK,UAAU,EAAE,UAAjB,CAAkB;IAC3B,IAAA,IAAI,GAAK,YAAY,EAAE,KAAnB,CAAoB;IAE1B,IAAA,KAAoC,QAAQ,CAAiB,IAAI,CAAC,EAAjE,aAAa,QAAA,EAAE,gBAAgB,QAAkC,CAAC;IACzE,yFAAyF;IAEzF,IAAM,oBAAoB,GAAG,WAAW,CACtC,UAAO,QAAgB;;;;;oBACrB,qEAAqE;oBACrE,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ;wBAAE,sBAAO;oBAE/B,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;oBAC7C,CAAC;oBAGgB,qBAAM,KAAK,CAAC,GAAG,CAC9B,WAAI,SAAS,2BAAwB,EACrC;4BACE,MAAM,EAAE,EAAE,QAAQ,UAAA,EAAE;4BACpB,eAAe,EAAE,IAAI;yBACtB,CACF,EAAA;;oBANK,QAAQ,GAAG,SAMhB;oBAED,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;;;;SACjC,EACD,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CACzB,CAAC;IAEF,OAAO,EAAE,oBAAoB,sBAAA,EAAE,aAAa,eAAA,EAAE,CAAC;AACjD,CAAC;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
};
|
|
37
37
|
import { useEffect, useMemo, useCallback } from "react";
|
|
38
38
|
import { useDispatch, useSelector } from "react-redux";
|
|
39
|
-
import { setProjectContext, selectCurrentList, selectSubLists, selectListsLoading, selectListHistory,
|
|
39
|
+
import { setProjectContext, selectCurrentList, selectSubLists, selectListsLoading, selectListHistory, selectSubListsMap, selectCurrentProjectId, } from "../../store/slices/listsSlice";
|
|
40
40
|
import { useListsActionsRedux } from "./useListsActionsRedux";
|
|
41
41
|
import useProject from "../projects/useProject";
|
|
42
42
|
import { useUserRedux } from "../auth-redux";
|
|
@@ -64,8 +64,8 @@ function useListsRedux(_) {
|
|
|
64
64
|
var listHistory = useSelector(function (state) {
|
|
65
65
|
return selectListHistory(state);
|
|
66
66
|
});
|
|
67
|
-
var
|
|
68
|
-
return
|
|
67
|
+
var subListsMap = useSelector(function (state) {
|
|
68
|
+
return selectSubListsMap(state);
|
|
69
69
|
});
|
|
70
70
|
var currentProjectId = useSelector(function (state) {
|
|
71
71
|
return selectCurrentProjectId(state);
|
|
@@ -88,12 +88,12 @@ function useListsRedux(_) {
|
|
|
88
88
|
useEffect(function () {
|
|
89
89
|
if (!user || !projectId || !currentList)
|
|
90
90
|
return;
|
|
91
|
-
// Check if sub-lists for this list are already
|
|
92
|
-
if (
|
|
93
|
-
return; // No need to fetch, we have
|
|
91
|
+
// Check if sub-lists for this list are already fetched
|
|
92
|
+
if (subListsMap[currentList.id] !== undefined) {
|
|
93
|
+
return; // No need to fetch, we already have the mapping (even if empty)
|
|
94
94
|
}
|
|
95
95
|
fetchSubLists(projectId, currentList.id);
|
|
96
|
-
}, [fetchSubLists, user, projectId, currentList,
|
|
96
|
+
}, [fetchSubLists, user, projectId, currentList, subListsMap]);
|
|
97
97
|
// Entity membership checker
|
|
98
98
|
var isEntityInList = useCallback(function (selectedEntityId) {
|
|
99
99
|
if (!currentList)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useListsRedux.js","sourceRoot":"","sources":["../../../../src/hooks/lists-redux/useListsRedux.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGvD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"useListsRedux.js","sourceRoot":"","sources":["../../../../src/hooks/lists-redux/useListsRedux.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGvD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AA0B7C;;;G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AgB;QAC5B,SAAS,EAAE,eAAe;QAC1B,cAAc,EAAE,oBAAoB;KACrC,CAAC,EAhBI,CAgBJ,EACF;QACE,WAAW;QACX,QAAQ;QACR,OAAO;QACP,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,cAAc;QACd,gBAAgB;QAChB,gBAAgB;QAChB,gBAAgB;QAChB,eAAe;QACf,oBAAoB;KACrB,CACF,CAAC;AACJ,CAAC;AAED,eAAe,aAAa,CAAC"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -10,9 +10,9 @@ EntityListProvider, EntityProvider, CommentSectionProvider, } from "./context";
|
|
|
10
10
|
export { useProject, useProjectData } from "./hooks/projects";
|
|
11
11
|
export { useSignTestingJwt } from "./hooks/crypto";
|
|
12
12
|
export { useAuthRedux, type UseAuthReduxValues } from "./hooks/auth-redux";
|
|
13
|
-
export { useAppNotificationsRedux, useAppNotificationsActionsRedux, type UseAppNotificationsReduxProps, type UseAppNotificationsReduxValues, } from "./hooks/app-notifications-redux";
|
|
14
|
-
export { useListsRedux, useListsActionsRedux, type UseListsReduxProps, type UseListsReduxValues, } from "./hooks/lists-redux";
|
|
15
13
|
export { useUserRedux, useUserActionsRedux, type UseUserReduxProps, type UseUserReduxValues, } from "./hooks/user-redux";
|
|
14
|
+
export { useAppNotificationsRedux, useAppNotificationsActionsRedux, type UseAppNotificationsReduxProps, type UseAppNotificationsReduxValues, } from "./hooks/app-notifications-redux";
|
|
15
|
+
export { useListsRedux, useListsActionsRedux, useIsEntitySaved, type UseListsReduxProps, type UseListsReduxValues, } from "./hooks/lists-redux";
|
|
16
16
|
export { useEntity, useEntityData, useCreateEntity, useFetchEntity, useFetchEntityByForeignId, useFetchEntityByShortId, useUpdateEntity, useEntityVotes, useDeleteEntity, useEntityList, useEntityListData, useInfusedData, } from "./hooks/entities";
|
|
17
17
|
export { useCommentSection, useCommentSectionData, useCreateComment, useFetchManyComments, useFetchComment, useFetchCommentByForeignId, useReplies, useUpdateComment, useCommentVotes, useDeleteComment, useEntityComments, useProfileComments, } from "./hooks/comments";
|
|
18
18
|
export { useFetchUser, useFetchUserByForeignId, useFetchUserFollowersCount, useFetchUserFollowingCount, useCheckUsernameAvailability, useFetchUserSuggestions, useMentions, useUpdateUser, useFetchFollow, useFollowUser, useUnfollowUser, } from "./hooks/users";
|
package/dist/esm/index.js
CHANGED
|
@@ -15,12 +15,12 @@ export { useProject, useProjectData } from "./hooks/projects";
|
|
|
15
15
|
export { useSignTestingJwt } from "./hooks/crypto";
|
|
16
16
|
// -- authentication (Redux-powered)
|
|
17
17
|
export { useAuthRedux } from "./hooks/auth-redux";
|
|
18
|
+
// -- (current) user (Redux-powered)
|
|
19
|
+
export { useUserRedux, useUserActionsRedux, } from "./hooks/user-redux";
|
|
18
20
|
// -- app notifications (Redux-powered)
|
|
19
21
|
export { useAppNotificationsRedux, useAppNotificationsActionsRedux, } from "./hooks/app-notifications-redux";
|
|
20
22
|
// -- lists (Redux-powered)
|
|
21
|
-
export { useListsRedux, useListsActionsRedux, } from "./hooks/lists-redux";
|
|
22
|
-
// -- (current) user (Redux-powered)
|
|
23
|
-
export { useUserRedux, useUserActionsRedux, } from "./hooks/user-redux";
|
|
23
|
+
export { useListsRedux, useListsActionsRedux, useIsEntitySaved, } from "./hooks/lists-redux";
|
|
24
24
|
// -- entities
|
|
25
25
|
export { useEntity, useEntityData, useCreateEntity, useFetchEntity, useFetchEntityByForeignId, useFetchEntityByShortId, useUpdateEntity, useEntityVotes, useDeleteEntity, useEntityList, useEntityListData, useInfusedData, } from "./hooks/entities";
|
|
26
26
|
// -- comments
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,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|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { PayloadAction } from "@reduxjs/toolkit";
|
|
2
2
|
import type { List } from "../../interfaces/models/List";
|
|
3
3
|
export interface ListsState {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[listId: string]: List[];
|
|
4
|
+
listsById: {
|
|
5
|
+
[listId: string]: List;
|
|
6
|
+
};
|
|
7
|
+
sublistsMap: {
|
|
8
|
+
[parentId: string]: string[];
|
|
10
9
|
};
|
|
10
|
+
currentListId: string | null;
|
|
11
|
+
listHistory: string[];
|
|
12
|
+
loading: boolean;
|
|
11
13
|
currentProjectId?: string;
|
|
12
14
|
}
|
|
13
15
|
export declare const listsSlice: import("@reduxjs/toolkit").Slice<ListsState, {
|
|
@@ -53,14 +55,19 @@ export declare const selectListsLoading: (state: {
|
|
|
53
55
|
export declare const selectListHistory: (state: {
|
|
54
56
|
lists: ListsState;
|
|
55
57
|
}) => List[];
|
|
56
|
-
export declare const
|
|
58
|
+
export declare const selectSubListsMap: (state: {
|
|
57
59
|
lists: ListsState;
|
|
58
60
|
}) => {
|
|
59
|
-
[
|
|
61
|
+
[parentId: string]: string[];
|
|
62
|
+
};
|
|
63
|
+
export declare const selectListsById: (state: {
|
|
64
|
+
lists: ListsState;
|
|
65
|
+
}) => {
|
|
66
|
+
[listId: string]: List;
|
|
60
67
|
};
|
|
61
68
|
export declare const selectCurrentProjectId: (state: {
|
|
62
69
|
lists: ListsState;
|
|
63
70
|
}) => string | undefined;
|
|
64
|
-
export declare const
|
|
71
|
+
export declare const selectCurrentListId: (state: {
|
|
65
72
|
lists: ListsState;
|
|
66
|
-
}) =>
|
|
73
|
+
}) => string | null;
|
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
-
if (ar || !(i in from)) {
|
|
4
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
-
ar[i] = from[i];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
-
};
|
|
10
1
|
var _a;
|
|
11
2
|
import { createSlice } from "@reduxjs/toolkit";
|
|
12
3
|
// Initial state
|
|
13
4
|
var initialState = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
listsById: {},
|
|
6
|
+
sublistsMap: {},
|
|
7
|
+
currentListId: null,
|
|
17
8
|
listHistory: [],
|
|
18
|
-
|
|
9
|
+
loading: false,
|
|
19
10
|
currentProjectId: undefined,
|
|
20
11
|
};
|
|
21
12
|
// Create the slice
|
|
22
13
|
export var listsSlice = createSlice({
|
|
23
|
-
name:
|
|
14
|
+
name: "lists",
|
|
24
15
|
initialState: initialState,
|
|
25
16
|
reducers: {
|
|
26
17
|
// Set the current project context
|
|
@@ -34,135 +25,129 @@ export var listsSlice = createSlice({
|
|
|
34
25
|
// Navigation actions
|
|
35
26
|
openList: function (state, action) {
|
|
36
27
|
var list = action.payload;
|
|
37
|
-
//
|
|
38
|
-
state.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
// Store the list if not already stored
|
|
29
|
+
if (!state.listsById[list.id]) {
|
|
30
|
+
state.listsById[list.id] = list;
|
|
31
|
+
}
|
|
32
|
+
// Push current list ID to history stack before opening new one
|
|
33
|
+
if (state.currentListId) {
|
|
34
|
+
state.listHistory.push(state.currentListId);
|
|
42
35
|
}
|
|
43
|
-
// Set new current list
|
|
44
|
-
state.
|
|
36
|
+
// Set new current list ID
|
|
37
|
+
state.currentListId = list.id;
|
|
45
38
|
},
|
|
46
39
|
goBack: function (state) {
|
|
47
40
|
if (state.listHistory.length === 0)
|
|
48
41
|
return;
|
|
49
|
-
var
|
|
50
|
-
if (!
|
|
42
|
+
var previousListId = state.listHistory.pop();
|
|
43
|
+
if (!previousListId)
|
|
51
44
|
return;
|
|
52
|
-
state.
|
|
53
|
-
// Check if sub-lists for this list are already in the cache
|
|
54
|
-
if (state.subListCache[previousList.id]) {
|
|
55
|
-
state.subLists = state.subListCache[previousList.id];
|
|
56
|
-
}
|
|
45
|
+
state.currentListId = previousListId;
|
|
57
46
|
},
|
|
58
47
|
goToRoot: function (state) {
|
|
59
48
|
if (state.listHistory.length === 0)
|
|
60
49
|
return;
|
|
61
|
-
var
|
|
50
|
+
var rootListId = state.listHistory[0];
|
|
62
51
|
state.listHistory = [];
|
|
63
|
-
state.
|
|
64
|
-
// Check if sub-lists for this list are already in the cache
|
|
65
|
-
if (state.subListCache[rootList.id]) {
|
|
66
|
-
state.subLists = state.subListCache[rootList.id];
|
|
67
|
-
}
|
|
52
|
+
state.currentListId = rootListId;
|
|
68
53
|
},
|
|
69
54
|
// Set current list (for initial root list fetch)
|
|
70
55
|
setCurrentList: function (state, action) {
|
|
71
|
-
|
|
56
|
+
var list = action.payload;
|
|
57
|
+
if (list) {
|
|
58
|
+
state.listsById[list.id] = list;
|
|
59
|
+
state.currentListId = list.id;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
state.currentListId = null;
|
|
63
|
+
}
|
|
72
64
|
},
|
|
73
|
-
// Set sub-lists and update
|
|
65
|
+
// Set sub-lists and update mapping
|
|
74
66
|
setSubLists: function (state, action) {
|
|
75
67
|
var _a = action.payload, lists = _a.lists, parentListId = _a.parentListId;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
68
|
+
// Store all lists in listsById
|
|
69
|
+
lists.forEach(function (list) {
|
|
70
|
+
state.listsById[list.id] = list;
|
|
71
|
+
});
|
|
72
|
+
// Update parent-child mapping
|
|
73
|
+
state.sublistsMap[parentListId] = lists.map(function (list) { return list.id; });
|
|
79
74
|
},
|
|
80
75
|
// Update current list (for entity add/remove operations)
|
|
81
76
|
updateCurrentList: function (state, action) {
|
|
82
77
|
var updatedList = action.payload;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (updatedList.parentId && state.subListCache[updatedList.parentId]) {
|
|
86
|
-
var parentSubLists = state.subListCache[updatedList.parentId];
|
|
87
|
-
state.subListCache[updatedList.parentId] = parentSubLists.map(function (list) {
|
|
88
|
-
return list.id === updatedList.id ? updatedList : list;
|
|
89
|
-
});
|
|
90
|
-
}
|
|
78
|
+
// Update in listsById (single source of truth)
|
|
79
|
+
state.listsById[updatedList.id] = updatedList;
|
|
91
80
|
},
|
|
92
|
-
// Update a list
|
|
81
|
+
// Update a list (now just updates in listsById)
|
|
93
82
|
updateListInSubLists: function (state, action) {
|
|
94
83
|
var updatedList = action.payload;
|
|
95
|
-
// Update in
|
|
96
|
-
state.
|
|
97
|
-
return list.id === updatedList.id ? updatedList : list;
|
|
98
|
-
});
|
|
99
|
-
// Update in cache
|
|
100
|
-
if (state.currentList && state.subListCache[state.currentList.id]) {
|
|
101
|
-
state.subListCache[state.currentList.id] = state.subListCache[state.currentList.id].map(function (list) {
|
|
102
|
-
return list.id === updatedList.id ? updatedList : list;
|
|
103
|
-
});
|
|
104
|
-
}
|
|
84
|
+
// Update in listsById (single source of truth)
|
|
85
|
+
state.listsById[updatedList.id] = updatedList;
|
|
105
86
|
},
|
|
106
87
|
// Add new list to sub-lists and navigate to it
|
|
107
88
|
addNewListAndNavigate: function (state, action) {
|
|
108
89
|
var newList = action.payload;
|
|
109
|
-
if (!state.
|
|
90
|
+
if (!state.currentListId)
|
|
110
91
|
return;
|
|
111
|
-
//
|
|
112
|
-
state.
|
|
113
|
-
// Push current list to history
|
|
114
|
-
state.listHistory.push(state.
|
|
92
|
+
// Store the new list
|
|
93
|
+
state.listsById[newList.id] = newList;
|
|
94
|
+
// Push current list ID to history
|
|
95
|
+
state.listHistory.push(state.currentListId);
|
|
115
96
|
// Set new list as current
|
|
116
|
-
state.
|
|
117
|
-
// Update
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
newList
|
|
121
|
-
|
|
97
|
+
state.currentListId = newList.id;
|
|
98
|
+
// Update parent-child mapping
|
|
99
|
+
if (newList.parentId) {
|
|
100
|
+
if (!state.sublistsMap[newList.parentId]) {
|
|
101
|
+
state.sublistsMap[newList.parentId] = [];
|
|
102
|
+
}
|
|
103
|
+
if (!state.sublistsMap[newList.parentId].includes(newList.id)) {
|
|
104
|
+
state.sublistsMap[newList.parentId].push(newList.id);
|
|
105
|
+
}
|
|
122
106
|
}
|
|
123
107
|
},
|
|
124
|
-
// Remove list from sub-lists and
|
|
108
|
+
// Remove list from sub-lists and storage
|
|
125
109
|
removeListFromSubLists: function (state, action) {
|
|
126
110
|
var listId = action.payload;
|
|
127
|
-
// Remove from
|
|
128
|
-
|
|
129
|
-
// Remove from
|
|
130
|
-
Object.keys(state.
|
|
131
|
-
state.
|
|
111
|
+
// Remove from listsById
|
|
112
|
+
delete state.listsById[listId];
|
|
113
|
+
// Remove from all parent-child mappings
|
|
114
|
+
Object.keys(state.sublistsMap).forEach(function (parentId) {
|
|
115
|
+
state.sublistsMap[parentId] = state.sublistsMap[parentId].filter(function (id) { return id !== listId; });
|
|
132
116
|
});
|
|
117
|
+
// Remove its own sublists mapping if it exists
|
|
118
|
+
delete state.sublistsMap[listId];
|
|
133
119
|
},
|
|
134
120
|
// Handle list deletion
|
|
135
121
|
handleListDeletion: function (state, action) {
|
|
136
|
-
var _a;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
state.subListCache[parentId] = state.subListCache[parentId].filter(function (list) { return list.id !== listId; });
|
|
122
|
+
var _a = action.payload, listId = _a.listId, parentId = _a.parentId;
|
|
123
|
+
// Remove from parent-child mapping
|
|
124
|
+
if (parentId && state.sublistsMap[parentId]) {
|
|
125
|
+
state.sublistsMap[parentId] = state.sublistsMap[parentId].filter(function (id) { return id !== listId; });
|
|
141
126
|
}
|
|
127
|
+
// Remove from listsById
|
|
128
|
+
delete state.listsById[listId];
|
|
129
|
+
// Remove its own sublists mapping
|
|
130
|
+
delete state.sublistsMap[listId];
|
|
142
131
|
// If deleted list is current list, go back
|
|
143
|
-
if (
|
|
144
|
-
if (state.listHistory.length === 0)
|
|
132
|
+
if (state.currentListId === listId) {
|
|
133
|
+
if (state.listHistory.length === 0) {
|
|
134
|
+
state.currentListId = null;
|
|
145
135
|
return;
|
|
146
|
-
|
|
147
|
-
|
|
136
|
+
}
|
|
137
|
+
var previousListId = state.listHistory.pop();
|
|
138
|
+
if (!previousListId) {
|
|
139
|
+
state.currentListId = null;
|
|
148
140
|
return;
|
|
149
|
-
state.currentList = previousList;
|
|
150
|
-
// Check if sub-lists for this list are already in the cache
|
|
151
|
-
if (state.subListCache[previousList.id]) {
|
|
152
|
-
state.subLists = state.subListCache[previousList.id];
|
|
153
141
|
}
|
|
154
|
-
|
|
155
|
-
else {
|
|
156
|
-
// Remove from current sub-lists
|
|
157
|
-
state.subLists = state.subLists.filter(function (list) { return list.id !== listId; });
|
|
142
|
+
state.currentListId = previousListId;
|
|
158
143
|
}
|
|
159
144
|
},
|
|
160
145
|
// Reset all lists data
|
|
161
146
|
resetLists: function (state) {
|
|
162
|
-
state.
|
|
163
|
-
state.
|
|
147
|
+
state.listsById = {};
|
|
148
|
+
state.sublistsMap = {};
|
|
149
|
+
state.currentListId = null;
|
|
164
150
|
state.listHistory = [];
|
|
165
|
-
state.subListCache = {};
|
|
166
151
|
state.loading = false;
|
|
167
152
|
},
|
|
168
153
|
// Handle errors by stopping loading
|
|
@@ -177,27 +162,40 @@ export var setProjectContext = (_a = listsSlice.actions, _a.setProjectContext),
|
|
|
177
162
|
export default listsSlice.reducer;
|
|
178
163
|
// Selectors
|
|
179
164
|
export var selectCurrentList = function (state) {
|
|
180
|
-
|
|
165
|
+
var _a = state.lists, currentListId = _a.currentListId, listsById = _a.listsById;
|
|
166
|
+
return currentListId ? listsById[currentListId] || null : null;
|
|
181
167
|
};
|
|
182
168
|
export var selectSubLists = function (state) {
|
|
183
|
-
|
|
169
|
+
var _a = state.lists, currentListId = _a.currentListId, sublistsMap = _a.sublistsMap, listsById = _a.listsById;
|
|
170
|
+
if (!currentListId || !sublistsMap[currentListId]) {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
return sublistsMap[currentListId]
|
|
174
|
+
.map(function (listId) { return listsById[listId]; })
|
|
175
|
+
.filter(Boolean); // Remove any undefined entries
|
|
184
176
|
};
|
|
185
177
|
export var selectListsLoading = function (state) {
|
|
186
178
|
return state.lists.loading;
|
|
187
179
|
};
|
|
188
180
|
export var selectListHistory = function (state) {
|
|
189
|
-
|
|
181
|
+
var _a = state.lists, listHistory = _a.listHistory, listsById = _a.listsById;
|
|
182
|
+
return listHistory
|
|
183
|
+
.map(function (listId) { return listsById[listId]; })
|
|
184
|
+
.filter(Boolean); // Remove any undefined entries
|
|
190
185
|
};
|
|
191
|
-
|
|
192
|
-
|
|
186
|
+
// New selector for the sublists mapping
|
|
187
|
+
export var selectSubListsMap = function (state) {
|
|
188
|
+
return state.lists.sublistsMap;
|
|
189
|
+
};
|
|
190
|
+
// New selector for all lists
|
|
191
|
+
export var selectListsById = function (state) {
|
|
192
|
+
return state.lists.listsById;
|
|
193
193
|
};
|
|
194
194
|
export var selectCurrentProjectId = function (state) {
|
|
195
195
|
return state.lists.currentProjectId;
|
|
196
196
|
};
|
|
197
|
-
//
|
|
198
|
-
export var
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
return state.lists.currentList.entityIds.some(function (id) { return id === entityId; });
|
|
202
|
-
}; };
|
|
197
|
+
// New selector for current list ID
|
|
198
|
+
export var selectCurrentListId = function (state) {
|
|
199
|
+
return state.lists.currentListId;
|
|
200
|
+
};
|
|
203
201
|
//# sourceMappingURL=listsSlice.js.map
|