Skip to content

Commit

Permalink
feat: remove default drives info from connect + add default drives to…
Browse files Browse the repository at this point in the history
… reactor config
  • Loading branch information
gpuente committed Sep 4, 2024
1 parent fd124b2 commit 67020b0
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 202 deletions.
63 changes: 30 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"@sentry/vite-plugin": "^2.22.2",
"@tanstack/react-virtual": "^3.8.1",
"did-key-creator": "^1.2.0",
"document-drive": "^1.0.0-alpha.88",
"document-drive": "1.0.0-alpha.89",
"document-model": "1.7.0",
"document-model-libs": "^1.83.0",
"electron-is-dev": "^3.0.1",
Expand Down
2 changes: 2 additions & 0 deletions src/app/document-drive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
import { IpcMain, webContents } from 'electron';
import { join } from 'path';
import { logger } from 'src/services/logger';
import { getReactorDefaultDrivesConfig } from 'src/utils/reactor';

export default (
documentModels: DocumentModel[],
Expand All @@ -28,6 +29,7 @@ export default (
new FilesystemStorage(join(path, 'Document Drives')),
new InMemoryCache(),
new BaseQueueManager(1, 10),
{ ...getReactorDefaultDrivesConfig() },
);

const promise = documentDrive
Expand Down
11 changes: 0 additions & 11 deletions src/components/modal/modals/SettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,6 @@ export const SettingsModal: React.FC<SettingsModalProps> = props => {
onContinue: () => {
clearStorage()
.then(() => {
// resets the default drive to unloaded if it is defined
setConfig(conf => ({
...conf,
defaultDrives: conf.defaultDrives
? conf.defaultDrives.map(drive => ({
...drive,
loaded: false,
}))
: undefined,
}));

// refreshes the page to reload default drive
onRefresh();
})
Expand Down
12 changes: 0 additions & 12 deletions src/hooks/useFeatureFlags/default-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,16 @@ const enabledEditors = ENABLED_EDITORS?.split(',');

const DISABLED_EDITORS =
import.meta.env.PH_CONNECT_DISABLED_EDITORS || undefined;
const DEFAULT_DRIVES_URL =
import.meta.env.PH_CONNECT_DEFAULT_DRIVES_URL || undefined;
const disabledEditors = DISABLED_EDITORS?.split(',');

export interface FeatureFlag {
defaultDrives?: {
url: string;
loaded: boolean;
}[];
editors: {
enabledEditors?: '*' | string[];
disabledEditors?: '*' | string[];
};
}

const defaultConfig: FeatureFlag = {
defaultDrives: DEFAULT_DRIVES_URL
? DEFAULT_DRIVES_URL.split(',').map(url => ({
url,
loaded: false,
}))
: undefined,
editors: {
enabledEditors: ENABLED_EDITORS === '*' ? '*' : enabledEditors,
disabledEditors: DISABLED_EDITORS === '*' ? '*' : disabledEditors,
Expand Down
139 changes: 0 additions & 139 deletions src/hooks/useLoadDefaultDrives.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/hooks/useLoadInitialData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { useUiNodes } from 'src/hooks/useUiNodes';
import { DefaultDocumentDriveServer as server } from 'src/utils/document-drive-server';
import { useClientErrorHandler } from './useClientErrorHandler';
import { useDocumentDrives } from './useDocumentDrives';
import { useLoadDefaultDrives } from './useLoadDefaultDrives';
import { isLatestVersion } from './utils';

export const useLoadInitialData = () => {
Expand All @@ -32,8 +31,6 @@ export const useLoadInitialData = () => {
const [, , serverSubscribeUpdates] = useDocumentDrives(server);
const clientErrorHandler = useClientErrorHandler();

useLoadDefaultDrives();

async function checkLatestVersion() {
const result = await isLatestVersion();
if (result === null) return;
Expand Down
Loading

0 comments on commit 67020b0

Please sign in to comment.