Skip to content

Commit

Permalink
Fix lint errors, remove unused jsonify implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 committed Oct 18, 2024
1 parent 6bd8362 commit 1b60e05
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 281 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ describe("Partial Hydration Behavior", () => {
}
);
let { container } = render(
// eslint-disable-next-line react/jsx-pascal-case
<ReactRouter_RouterProvider router={router} />
);

Expand Down Expand Up @@ -176,6 +177,7 @@ describe("Partial Hydration Behavior", () => {
}
);
let { container } = render(
// eslint-disable-next-line react/jsx-pascal-case
<ReactRouter_RouterProvider router={router} />
);

Expand Down
6 changes: 1 addition & 5 deletions packages/react-router/lib/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,7 @@ export function RouterProvider({
let setState = React.useCallback<RouterSubscriber>(
(
newState: RouterState,
{
deletedFetchers,
flushSync: flushSync,
viewTransitionOpts: viewTransitionOpts,
}
{ deletedFetchers, flushSync, viewTransitionOpts }
) => {
deletedFetchers.forEach((key) => fetcherData.current.delete(key));
newState.fetchers.forEach((fetcher, key) => {
Expand Down
19 changes: 3 additions & 16 deletions packages/react-router/lib/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -998,13 +998,6 @@ export function createRouter(init: RouterInit): Router {
// we don't need to update UI state if they change
let blockerFunctions = new Map<string, BlockerFunction>();

// Map of pending patchRoutesOnNavigation() promises (keyed by path/matches) so
// that we only kick them off once for a given combo
let pendingPatchRoutes = new Map<
string,
ReturnType<AgnosticPatchRoutesOnNavigationFunction>
>();

// Flag to ignore the next history update, so we can revert the URL change on
// a POP navigation that was blocked by the user without touching router state
let unblockBlockerHistoryUpdate: (() => void) | undefined = undefined;
Expand Down Expand Up @@ -2750,7 +2743,7 @@ export function createRouter(init: RouterInit): Router {
}

for (let [routeId, result] of Object.entries(results)) {
if (isRedirectDataStrategyResultResult(result)) {
if (isRedirectDataStrategyResult(result)) {
let response = result.result as Response;
dataResults[routeId] = {
type: ResultType.redirect,
Expand Down Expand Up @@ -2779,8 +2772,6 @@ export function createRouter(init: RouterInit): Router {
fetchersToLoad: RevalidatingFetcher[],
request: Request
) {
let currentMatches = state.matches;

// Kick off loaders and fetchers in parallel
let loaderResultsPromise = callDataStrategy(
"loader",
Expand Down Expand Up @@ -3861,7 +3852,7 @@ export function createStaticHandler(
return;
}
let result = results[match.route.id];
if (isRedirectDataStrategyResultResult(result)) {
if (isRedirectDataStrategyResult(result)) {
let response = result.result as Response;
// Throw redirects and let the server handle them with an HTTP redirect
throw normalizeRelativeRoutingRedirectResponse(
Expand Down Expand Up @@ -5349,10 +5340,6 @@ function isHashChangeOnly(a: Location, b: Location): boolean {
return false;
}

function isPromise<T = unknown>(val: unknown): val is Promise<T> {
return typeof val === "object" && val != null && "then" in val;
}

function isDataStrategyResult(result: unknown): result is DataStrategyResult {
return (
result != null &&
Expand All @@ -5363,7 +5350,7 @@ function isDataStrategyResult(result: unknown): result is DataStrategyResult {
);
}

function isRedirectDataStrategyResultResult(result: DataStrategyResult) {
function isRedirectDataStrategyResult(result: DataStrategyResult) {
return (
isResponse(result.result) && redirectStatusCodes.has(result.result.status)
);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-router/lib/server-runtime/headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function getDocumentHeaders(
// Only expose errorHeaders to the leaf headers() function to
// avoid duplication via parentHeaders
let includeErrorHeaders =
errorHeaders != undefined && idx === matches.length - 1;
errorHeaders != null && idx === matches.length - 1;
// Only prepend cookies from errorHeaders at the leaf renderable route
// when it's not the same as loaderHeaders/actionHeaders to avoid
// duplicate cookies
Expand Down
257 changes: 0 additions & 257 deletions packages/react-router/lib/server-runtime/jsonify.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/react-router/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { DataWithResponseInit } from "./router/utils";
import type { AppLoadContext } from "./server-runtime/data";
import type { Jsonify } from "./server-runtime/jsonify";
import type { Serializable } from "./server-runtime/single-fetch";

export type Expect<T extends true> = T;
Expand Down
4 changes: 3 additions & 1 deletion templates/basic/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export default {
const config = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

export default config;

0 comments on commit 1b60e05

Please sign in to comment.