Skip to content

Commit b6fe01f

Browse files
committed
[B] Even more useFromStore migrations
1 parent 8d541c5 commit b6fe01f

File tree

3 files changed

+15
-15
lines changed
  • client/src
    • backend/containers
    • global/components/Annotation/Annotation/TextContent/FromNodes

3 files changed

+15
-15
lines changed

client/src/backend/containers/project/collaborators/Add.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import { useFromStore } from "hooks";
1010
export default function AddCollaboratorContainer({ projectId, refresh }) {
1111
const { t } = useTranslation();
1212
const { id } = useParams();
13-
const collaborator = useFromStore(
14-
`entityStore.entities.flattenedCollaborators.${id}`
15-
);
13+
const collaborator = useFromStore({
14+
path: `entityStore.entities.flattenedCollaborators.${id}`
15+
});
1616

1717
return (
1818
<section>

client/src/backend/containers/text/collaborators/Add.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import { useFromStore } from "hooks";
1010
export default function AddCollaboratorContainer({ textId, refresh }) {
1111
const { t } = useTranslation();
1212
const { id } = useParams();
13-
const collaborator = useFromStore(
14-
`entityStore.entities.flattenedCollaborators.${id}`
15-
);
13+
const collaborator = useFromStore({
14+
path: `entityStore.entities.flattenedCollaborators.${id}`
15+
});
1616

1717
return (
1818
<section>

client/src/global/components/Annotation/Annotation/TextContent/FromNodes/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ function AnnotationWithNodes({
2828
);
2929

3030
const { sectionId } = useParams();
31-
const bodyJSON = useFromStore(
32-
`entityStore.entities.textSections["${sectionId}"].attributes.bodyJSON`
33-
);
31+
const bodyJSON = useFromStore({
32+
path: `entityStore.entities.textSections["${sectionId}"].attributes.bodyJSON`
33+
});
3434

3535
const length = selection?.replace("\n", " ")?.length;
3636
/* eslint-disable no-nested-ternary */
@@ -68,12 +68,12 @@ function AnnotationWithNodes({
6868
const nodesToRender =
6969
finalStack?.children ?? finalStack?.content ? [finalStack] : undefined;
7070

71-
const activeGroup = useFromStore(
72-
`ui.persistent.reader.readingGroups.currentAnnotatingReadingGroup`
73-
);
74-
const memberships = useFromStore(
75-
`entityStore.entities.readingGroupMemberships`
76-
);
71+
const activeGroup = useFromStore({
72+
path: `ui.persistent.reader.readingGroups.currentAnnotatingReadingGroup`
73+
});
74+
const memberships = useFromStore({
75+
path: `entityStore.entities.readingGroupMemberships`
76+
});
7777
const membership =
7878
typeof memberships === "object"
7979
? Object.keys(memberships)?.find(

0 commit comments

Comments
 (0)