Skip to content

Commit 7a7d844

Browse files
committed
[C] Update useFromStore signature
1 parent 9cbc704 commit 7a7d844

File tree

50 files changed

+108
-75
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+108
-75
lines changed

client/src/backend/components/authoring/EditSectionForm/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ export default function EditSectionForm({
107107
}
108108
}, [initialSlateValue, t]);
109109

110-
const stylesheetData = useFromStore(`entityStore.entities.stylesheets`);
110+
const stylesheetData = useFromStore({
111+
path: `entityStore.entities.stylesheets`
112+
});
111113
const stylesheetDataKeys = stylesheetData ? Object.keys(stylesheetData) : [];
112114

113115
const appliedStylesheets = stylesheetDataKeys

client/src/backend/components/list/EntitiesList/Entity/ContributorRow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function ContributorRow({ entity, onDelete, onEdit, ...props }) {
1818

1919
const { roles } = attributes ?? {};
2020

21-
const authentication = useFromStore("authentication");
21+
const authentication = useFromStore({ path: "authentication" });
2222
const auth = new Authorization();
2323
const canAccessMakers = auth.authorizeAbility({
2424
entity: "maker",

client/src/backend/components/list/EntitiesList/Entity/PendingEntitlementRow.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ export default function PendingEntitlementRow({
1717

1818
const { email, subjectId, expiresOn } = entitlement?.attributes ?? {};
1919

20-
const project = useFromStore(`entityStore.entities.projects["${subjectId}"]`);
21-
const journal = useFromStore(`entityStore.entities.journals["${subjectId}"]`);
20+
const project = useFromStore({
21+
path: `entityStore.entities.projects["${subjectId}"]`
22+
});
23+
const journal = useFromStore({
24+
path: `entityStore.entities.journals["${subjectId}"]`
25+
});
2226
const target = project ?? journal;
2327

2428
const subtitle = target ? target.attributes?.titlePlaintext : "";

client/src/backend/containers/journal/AccessWrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function JournalAccessWrapper({ journal, route }) {
1313
const closeUrl = lh.link("backendJournalAccess", journal.id);
1414

1515
const authorization = new Authorization();
16-
const authentication = useFromStore("authentication");
16+
const authentication = useFromStore({ path: "authentication" });
1717

1818
const canGrantPermissions = authorization.authorizeAbility({
1919
authentication,

client/src/backend/containers/text/section/Ingest.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ export default function IngestSectionContainer({ textId }) {
2222
condition: !!ingestionId
2323
});
2424

25-
const sectionName = useFromStore(
26-
`entityStore.entities.textSections[${ingestion?.attributes.textSectionId}]`
27-
)?.attributes.name;
25+
const sectionName = useFromStore({
26+
path: `entityStore.entities.textSections[${ingestion?.attributes.textSectionId}]`
27+
})?.attributes.name;
2828

2929
const shouldRender =
3030
(!!sectionId && !!section) ||

client/src/frontend/components/entity/useEntityHeadContent/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const maybePrepend = (entityTitle, prepend) => {
3636

3737
export const useMetaTitle = (entity, parent, prepend) => {
3838
const { t } = useTranslation();
39-
const settings = useFromStore("settings", "select");
39+
const settings = useFromStore({ requestKey: "settings", action: "select" });
4040

4141
if (!entity?.attributes) return undefined;
4242

client/src/frontend/components/issue/Detail.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Authorize from "hoc/Authorize";
1111

1212
function Detail({ issue }) {
1313
const { isStandalone } = useFrontendModeContext();
14-
const settings = useFromStore("settings", "select");
14+
const settings = useFromStore({ requestKey: "settings", action: "select" });
1515
const libraryDisabled = settings?.attributes?.general?.libraryDisabled;
1616

1717
return (

client/src/frontend/components/preferences/NotificationsForm/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default function NotificationsForm({
1515
preferences,
1616
setPreferences
1717
}) {
18-
const authentication = useFromStore("authentication");
18+
const authentication = useFromStore({ path: "authentication" });
1919
const { t } = useTranslation();
2020

2121
const digestOpen = preferences?.digest !== "never";

client/src/frontend/components/privacy/AccountData/DeleteConfirm/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Form from "global/components/form";
88
import * as Styled from "./styles";
99

1010
export default function DeleteConfirm() {
11-
const { currentUser } = useFromStore("authentication");
11+
const { currentUser } = useFromStore({ path: "authentication" });
1212
const { t } = useTranslation();
1313
const dispatch = useDispatch();
1414

client/src/frontend/components/privacy/CookiesForm/CookiesFormFields/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function CookiesFormFields({
1313
googleAnalyticsEnabled
1414
}) {
1515
const { t } = useTranslation();
16-
const settings = useFromStore("settings", "select");
16+
const settings = useFromStore({ requestKey: "settings", action: "select" });
1717

1818
const installationName = settings?.attributes?.general?.installationName;
1919

0 commit comments

Comments
 (0)