@selfcommunity/react-ui 0.11.0-alpha.55 → 0.11.0-alpha.57
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/lib/cjs/components/EventHeader/EventHeader.js +2 -1
- package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.js +1 -1
- package/lib/esm/components/EventHeader/EventHeader.js +2 -1
- package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.js +1 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +2 -2
|
@@ -20,6 +20,7 @@ const EventSubscribeButton_1 = tslib_1.__importDefault(require("../EventSubscrib
|
|
|
20
20
|
const User_1 = tslib_1.__importDefault(require("../User"));
|
|
21
21
|
const constants_1 = require("./constants");
|
|
22
22
|
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
23
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
23
24
|
const classes = {
|
|
24
25
|
root: `${constants_1.PREFIX}-root`,
|
|
25
26
|
cover: `${constants_1.PREFIX}-cover`,
|
|
@@ -85,7 +86,7 @@ function EventHeader(inProps) {
|
|
|
85
86
|
// CONTEXT
|
|
86
87
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
87
88
|
// HOOKS
|
|
88
|
-
const { scEvent, setSCEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
|
|
89
|
+
const { scEvent, setSCEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event, cacheStrategy: utils_1.CacheStrategies.NETWORK_ONLY });
|
|
89
90
|
const theme = (0, material_1.useTheme)();
|
|
90
91
|
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
91
92
|
// INTL
|
|
@@ -98,7 +98,7 @@ function EventSubscribeButton(inProps) {
|
|
|
98
98
|
const { scEvent, setSCEvent } = (0, react_core_1.useSCFetchEvent)({
|
|
99
99
|
id: eventId,
|
|
100
100
|
event,
|
|
101
|
-
cacheStrategy: authUserId ? utils_1.CacheStrategies.
|
|
101
|
+
cacheStrategy: authUserId ? utils_1.CacheStrategies.NETWORK_ONLY : utils_1.CacheStrategies.STALE_WHILE_REVALIDATE
|
|
102
102
|
});
|
|
103
103
|
const isEventAdmin = (0, react_1.useMemo)(() => { var _a; return scUserContext.user && ((_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
|
|
104
104
|
// HANDLERS
|
|
@@ -18,6 +18,7 @@ import EventSubscribeButton from '../EventSubscribeButton';
|
|
|
18
18
|
import User from '../User';
|
|
19
19
|
import { PREFIX } from './constants';
|
|
20
20
|
import EventHeaderSkeleton from './Skeleton';
|
|
21
|
+
import { CacheStrategies } from '@selfcommunity/utils';
|
|
21
22
|
const classes = {
|
|
22
23
|
root: `${PREFIX}-root`,
|
|
23
24
|
cover: `${PREFIX}-cover`,
|
|
@@ -83,7 +84,7 @@ export default function EventHeader(inProps) {
|
|
|
83
84
|
// CONTEXT
|
|
84
85
|
const scUserContext = useSCUser();
|
|
85
86
|
// HOOKS
|
|
86
|
-
const { scEvent, setSCEvent } = useSCFetchEvent({ id: eventId, event });
|
|
87
|
+
const { scEvent, setSCEvent } = useSCFetchEvent({ id: eventId, event, cacheStrategy: CacheStrategies.NETWORK_ONLY });
|
|
87
88
|
const theme = useTheme();
|
|
88
89
|
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
89
90
|
// INTL
|
|
@@ -96,7 +96,7 @@ export default function EventSubscribeButton(inProps) {
|
|
|
96
96
|
const { scEvent, setSCEvent } = useSCFetchEvent({
|
|
97
97
|
id: eventId,
|
|
98
98
|
event,
|
|
99
|
-
cacheStrategy: authUserId ? CacheStrategies.
|
|
99
|
+
cacheStrategy: authUserId ? CacheStrategies.NETWORK_ONLY : CacheStrategies.STALE_WHILE_REVALIDATE
|
|
100
100
|
});
|
|
101
101
|
const isEventAdmin = useMemo(() => { var _a; return scUserContext.user && ((_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
|
|
102
102
|
// HANDLERS
|