Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lint errors, remove unused jsonify implementation #12154

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
>();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused


// 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;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused


// 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;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused


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";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused

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;