Skip to content

Commit

Permalink
[keyserver, web] Remove baseHref field
Browse files Browse the repository at this point in the history
Summary:
issue: https://linear.app/comm/issue/ENG-4214/review-basehref-filed-in-web-redux
`baseHref` field can be merged with `urlPrefix`. To see the full explanation see the discussion in the linked issue.

Test Plan: Checked that web still works - connects to the keyserver. Ran `yarn flow-all`

Reviewers: michal, kamil

Reviewed By: michal

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D8704
  • Loading branch information
InkaAlicja committed Aug 15, 2023
1 parent 3a72923 commit eb29451
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
9 changes: 3 additions & 6 deletions keyserver/src/responders/website-responders.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,11 @@ const initialReduxStateValidator = tShape({
'default communityPickerStore',
_isEqual({ chat: null, calendar: null }),
),
urlPrefix: tString(''),
urlPrefix: t.String,
windowDimensions: t.irreducible(
'default windowDimensions',
_isEqual({ width: 0, height: 0 }),
),
baseHref: t.String,
notifPermissionAlertInfo: t.irreducible(
'default notifPermissionAlertInfo',
_isEqual(defaultNotifPermissionAlertInfo),
Expand Down Expand Up @@ -267,7 +266,7 @@ async function websiteResponder(
const appURLFacts = getAppURLFactsFromRequestURL(req.originalUrl);
const { basePath, baseDomain } = appURLFacts;
const baseURL = basePath.replace(/\/$/, '');
const baseHref = baseDomain + baseURL;
const urlPrefix = baseDomain + baseURL;

const loadingPromise = getWebpackCompiledRootComponentForSSR();
const hasNotAcknowledgedPoliciesPromise = hasAnyNotAcknowledgedPolicies(
Expand Down Expand Up @@ -581,10 +580,8 @@ async function websiteResponder(
loadingStatuses: {},
calendarFilters: defaultCalendarFilters,
communityPickerStore: { chat: null, calendar: null },
// We can use paths local to the <base href> on web
urlPrefix: '',
urlPrefix,
windowDimensions: { width: 0, height: 0 },
baseHref,
notifPermissionAlertInfo: defaultNotifPermissionAlertInfo,
connection: (async () => ({
...defaultConnectionInfo(viewer.platform ?? 'web', viewer.timeZone),
Expand Down
1 change: 0 additions & 1 deletion web/redux/redux-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export type AppState = {
+urlPrefix: string,
+windowDimensions: WindowDimensions,
+deviceToken: ?string,
+baseHref: string,
+notifPermissionAlertInfo: NotifPermissionAlertInfo,
+connection: ConnectionInfo,
+watchedThreadIDs: $ReadOnlyArray<string>,
Expand Down
2 changes: 1 addition & 1 deletion web/selectors/socket-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { initOlm } from '../olm/olm-utils.js';
import type { AppState } from '../redux/redux-setup.js';

const openSocketSelector: (state: AppState) => () => WebSocket = createSelector(
(state: AppState) => state.baseHref,
(state: AppState) => state.urlPrefix,
createOpenSocketFunction,
);

Expand Down

0 comments on commit eb29451

Please sign in to comment.