Skip to content

Commit

Permalink
fix for linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
AlemTuzlak committed Nov 8, 2024
1 parent 74cfb53 commit 3b58063
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 33 deletions.
6 changes: 4 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"lineWidth": 120
},
"files": {
"ignore": ["test-apps/**", "docs/**", "./src/external/**", "./plugins/**", "./src/input.css"]
"ignore": ["test-apps/**", "docs/**", "./src/external/**", "./plugins/**", "./src/input.css", "./src/gradients.css"]
},
"organizeImports": {
"enabled": true
Expand All @@ -28,7 +28,9 @@
"noExplicitAny": "off",
"noConsole": {
"level": "error",
"options": { "allow": ["assert", "error", "info", "warn"] }
"options": {
"allow": ["assert", "error", "info", "warn"]
}
}
},
"style": {
Expand Down
9 changes: 3 additions & 6 deletions src/client/context/RDTContext.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Dispatch } from "react"
import type React from "react"
import { createContext, useEffect, useMemo, useReducer, useState } from "react"
import { createContext, useEffect, useMemo, useReducer } from "react"
import type { NetworkRequest } from "../components/network-tracer/types.js"
import { useRemoveBody } from "../hooks/detached/useRemoveBody.js"
import { checkIsDetached, checkIsDetachedOwner, checkIsDetachedWindow } from "../utils/detached.js"
Expand Down Expand Up @@ -67,9 +67,7 @@ export const getSettings = () => {
}
}

export const getExistingStateFromStorage = (
config?: RdtClientConfig & { editorName?: string; requests?: NetworkRequest[] }
) => {
export const getExistingStateFromStorage = (config?: RdtClientConfig & { editorName?: string }) => {
const existingState = getStorageItem(REACT_ROUTER_DEV_TOOLS_STATE)
const settings = getSettings()

Expand All @@ -87,7 +85,6 @@ export const getExistingStateFromStorage = (
},
detachedWindow,
detachedWindowOwner,
requests: [],
}
return state
}
Expand Down Expand Up @@ -119,7 +116,7 @@ export const RDTContextProvider = ({ children, config }: ContextProps) => {
useRemoveBody(state)

useEffect(() => {
const { settings, detachedWindow, detachedWindowOwner, requests, ...rest } = state
const { settings, detachedWindow, detachedWindowOwner, ...rest } = state
// Store user settings for dev tools into local storage
setStorageItem(REACT_ROUTER_DEV_TOOLS_SETTINGS, JSON.stringify(settings))
// Store general state into local storage
Expand Down
26 changes: 1 addition & 25 deletions src/client/context/rdtReducer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { ActionEvent, LoaderEvent } from "../../server/event-queue.js"
import type { NetworkRequest } from "../components/network-tracer/types.js"
import type { Tabs } from "../tabs/index.js"
import { cutArrayToFirstN } from "../utils/common.js"
import type { Terminal } from "./terminal/types.js"
Expand Down Expand Up @@ -159,11 +158,8 @@ export type RemixDevToolsState = {
persistOpen: boolean
detachedWindow: boolean
detachedWindowOwner: boolean
requests: NetworkRequest[]
}

const requestMap = new Map<string, NetworkRequest>()

export const initialState: RemixDevToolsState = {
timeline: [],
terminals: [{ id: 0, locked: false, output: [], history: [] }],
Expand Down Expand Up @@ -205,7 +201,6 @@ export const initialState: RemixDevToolsState = {
persistOpen: false,
detachedWindow: false,
detachedWindowOwner: false,
requests: [],
}

/** Reducer action types */
Expand All @@ -214,11 +209,6 @@ type SetTimelineEvent = {
payload: TimelineEvent
}

type SetNetworkRequests = {
type: "SET_NETWORK_REQUESTS"
payload: NetworkRequest[]
}

type ToggleTerminalLock = {
type: "TOGGLE_TERMINAL_LOCK"
payload: {
Expand Down Expand Up @@ -317,7 +307,6 @@ export type RemixDevToolsActions =
| SetIsSubmittedAction
| SetServerInfo
| SetHtmlErrors
| SetNetworkRequests
| SetPersistOpenAction

export const rdtReducer = (state: RemixDevToolsState, { type, payload }: RemixDevToolsActions): RemixDevToolsState => {
Expand Down Expand Up @@ -345,20 +334,7 @@ export const rdtReducer = (state: RemixDevToolsState, { type, payload }: RemixDe
...payload,
},
}
case "SET_NETWORK_REQUESTS": {
const newRequests = payload.filter((req) => !requestMap.has(req.id + req.startTime))
console.log("existingRequests", state.requests)
console.log("newRequests", newRequests)
for (const req of newRequests) {
requestMap.set(req.id + req.startTime, req)
}
const finalRequests = state.requests.concat(newRequests)
console.log("finalRequests", finalRequests)
return {
...state,
requests: finalRequests,
}
}

case "SET_TIMELINE_EVENT":
return {
...state,
Expand Down

0 comments on commit 3b58063

Please sign in to comment.