Skip to content

Commit

Permalink
Revert "[web] Migrate to new id schema"
Browse files Browse the repository at this point in the history
This reverts commit 3293f7d.
  • Loading branch information
MichalGniadek committed Jul 13, 2023
1 parent 05657aa commit 932c409
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 42 deletions.
1 change: 0 additions & 1 deletion keyserver/src/responders/website-responders.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,6 @@ async function websiteResponder(
viewer.platformDetails,
initialReduxStateValidator,
initialReduxState,
true,
);
const jsonStream = streamJSON(res, validatedInitialReduxState);

Expand Down
12 changes: 4 additions & 8 deletions keyserver/src/utils/validation-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
hasMinCodeVersion,
FUTURE_CODE_VERSION,
} from 'lib/shared/version-utils.js';
import { type PlatformDetails } from 'lib/types/device-types.js';
import { type PlatformDetails, isWebPlatform } from 'lib/types/device-types.js';
import { ServerError } from 'lib/utils/errors.js';
import {
tCookie,
Expand Down Expand Up @@ -39,8 +39,8 @@ async function validateInput<T>(
if (
hasMinCodeVersion(viewer.platformDetails, {
native: FUTURE_CODE_VERSION,
web: FUTURE_CODE_VERSION,
}) &&
!isWebPlatform(viewer.platformDetails?.platform) &&
convertToNewIDSchema
) {
try {
Expand All @@ -61,7 +61,6 @@ function validateOutput<T>(
platformDetails: ?PlatformDetails,
outputValidator: TType<T>,
data: T,
alwaysConvertSchema?: boolean,
): T {
if (!outputValidator.is(data)) {
console.trace(
Expand All @@ -72,11 +71,8 @@ function validateOutput<T>(
}

if (
(hasMinCodeVersion(platformDetails, {
native: FUTURE_CODE_VERSION,
web: FUTURE_CODE_VERSION,
}) ||
alwaysConvertSchema) &&
hasMinCodeVersion(platformDetails, { native: FUTURE_CODE_VERSION }) &&
!isWebPlatform(platformDetails?.platform) &&
convertToNewIDSchema
) {
return convertServerIDsToClientIDs(
Expand Down
33 changes: 0 additions & 33 deletions web/redux/persist.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @flow

import invariant from 'invariant';
import { getStoredState, purgeStoredState } from 'redux-persist';
import storage from 'redux-persist/es/storage/index.js';
import type { PersistConfig } from 'redux-persist/src/types.js';
Expand All @@ -10,10 +9,6 @@ import {
type StorageMigrationFunction,
} from 'lib/shared/create-async-migrate.js';
import { isDev } from 'lib/utils/dev-utils.js';
import {
generateIDSchemaMigrationOpsForDrafts,
convertDraftStoreToNewIDSchema,
} from 'lib/utils/migration-utils.js';

import commReduxStorageEngine from './comm-redux-storage-engine.js';
import type { AppState } from './redux-setup.js';
Expand Down Expand Up @@ -66,34 +61,6 @@ const migrations = {

return state;
},
[3]: async (state: AppState) => {
let newState = state;
if (state.draftStore) {
newState = {
...newState,
draftStore: convertDraftStoreToNewIDSchema(state.draftStore),
};
}

if (!isDatabaseSupported) {
return newState;
}

const stores = await databaseModule.schedule({
type: workerRequestMessageTypes.GET_CLIENT_STORE,
});
invariant(stores?.store, 'Stores should exist');
await databaseModule.schedule({
type: workerRequestMessageTypes.PROCESS_STORE_OPERATIONS,
storeOperations: {
draftStoreOperations: generateIDSchemaMigrationOpsForDrafts(
stores.store.drafts,
),
},
});

return newState;
},
};

const persistWhitelist = [
Expand Down

0 comments on commit 932c409

Please sign in to comment.