Skip to content

Commit

Permalink
exclude router from appoptions type
Browse files Browse the repository at this point in the history
  • Loading branch information
Beth Shook committed Apr 15, 2024
1 parent bc42d38 commit 087085f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 23 deletions.
16 changes: 0 additions & 16 deletions script/prerender/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ import { createDiskCache } from './fileUtils';
import renderManifest from './renderManifest';
import { renderSitemap, renderSitemapIndex } from './sitemap';
import userLoader from './stubbedUserLoader';
import { createRouterService } from '../../src/app/navigation/routerService';
import * as developer from '../../src/app/developer';
import * as errors from '../../src/app/errors';
import * as content from '../../src/app/content';

const {
APP_ENV,
Expand All @@ -40,16 +36,6 @@ const {
REACT_APP_SEARCH_URL,
} = config;

export const routes = Object.values({
...(
APP_ENV !== 'production'
? developer.routes
: /* istanbul ignore next */ {} as typeof developer.routes
),
...content.routes,
...errors.routes,
});

let networkTime = 0;
(global as any).fetch = (...args: Parameters<typeof fetch>) => {
const networkTimer = minuteCounter();
Expand Down Expand Up @@ -79,7 +65,6 @@ async function render() {
});
const practiceQuestionsLoader = createPracticeQuestionsLoader();
const bookConfigLoader = createBookConfigLoader();
const router = createRouterService(routes);

const {server} = await startServer({port, onlyProxy: true});
const renderHelpers = {
Expand All @@ -93,7 +78,6 @@ async function render() {
searchClient,
userLoader,
imageCDNUtils: createImageCDNUtils({prefetchResolutions: true}),
router,
};

const books = await prepareBooks(archiveLoader, osWebLoader);
Expand Down
3 changes: 0 additions & 3 deletions script/prerender/thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import {
} from './sitemap';
import userLoader from './stubbedUserLoader';
import { createRouterService } from '../../src/app/navigation/routerService';
import { routes } from './local';

const MAX_CONCURRENT_CONNECTIONS = 5;

Expand Down Expand Up @@ -130,7 +129,6 @@ async function makeTaskFunctionsMap() {
const buyPrintConfigLoader = createBuyPrintConfigLoader(REACT_APP_BUY_PRINT_CONFIG_URL);
const practiceQuestionsLoader = createPracticeQuestionsLoader();
const bookConfigLoader = createBookConfigLoader();
const router = createRouterService(routes);

const services = {
archiveLoader,
Expand All @@ -143,7 +141,6 @@ async function makeTaskFunctionsMap() {
searchClient,
userLoader,
imageCDNUtils: createImageCDNUtils({prefetchResolutions: true}),
router,
};

return {
Expand Down
3 changes: 2 additions & 1 deletion src/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ const defaultServices = () => ({
export interface AppOptions {
initialState?: Partial<AppState>;
initialEntries?: AnyMatch[];
services: Pick<AppServices, Exclude<keyof AppServices, 'history' | keyof ReturnType<typeof defaultServices>>>;
services:
Pick<AppServices, Exclude<keyof AppServices, 'history' | 'router' | keyof ReturnType<typeof defaultServices>>>;
}

export default (options: AppOptions) => {
Expand Down
4 changes: 1 addition & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import queryString from 'query-string';
import React from 'react';
import ReactDOM from 'react-dom';
import Loadable from 'react-loadable';
import createApp, { routes } from './app';
import createApp from './app';
import { onPageFocusChange } from './app/domUtils';
import * as selectHead from './app/head/selectors';
import createIntl from './app/messages/createIntl';
Expand All @@ -28,7 +28,6 @@ import pollUpdates from './helpers/pollUpdates';
import Sentry from './helpers/Sentry';
import './index.css';
import * as serviceWorker from './serviceWorker';
import { createRouterService } from './app/navigation/routerService';

const window = assertWindow('Browser entrypoint must be used in the browser');
const document = window.document;
Expand Down Expand Up @@ -67,7 +66,6 @@ const app = createApp({
searchClient: createSearchClient(searchUrl),
userLoader,
imageCDNUtils: createImageCDNUtils(),
router: createRouterService(routes),
},
});

Expand Down

0 comments on commit 087085f

Please sign in to comment.