Fix linting

This commit is contained in:
yangdx
2025-03-12 18:55:15 +08:00
parent 5c1cf6a8ff
commit 330f608fa9
7 changed files with 19 additions and 17 deletions

View File

@@ -427,10 +427,12 @@ def create_app(args):
class NoCacheStaticFiles(StaticFiles): class NoCacheStaticFiles(StaticFiles):
async def get_response(self, path: str, scope): async def get_response(self, path: str, scope):
response = await super().get_response(path, scope) response = await super().get_response(path, scope)
if path.endswith('.html'): if path.endswith(".html"):
response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate' response.headers["Cache-Control"] = (
response.headers['Pragma'] = 'no-cache' "no-cache, no-store, must-revalidate"
response.headers['Expires'] = '0' )
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "0"
return response return response
# Webui mount webui/index.html # Webui mount webui/index.html

View File

@@ -9,10 +9,10 @@ import { useTranslation } from 'react-i18next'
export default function AppSettings() { export default function AppSettings() {
const [opened, setOpened] = useState<boolean>(false) const [opened, setOpened] = useState<boolean>(false)
const { t } = useTranslation() const { t } = useTranslation()
const language = useSettingsStore.use.language() const language = useSettingsStore.use.language()
const setLanguage = useSettingsStore.use.setLanguage() const setLanguage = useSettingsStore.use.setLanguage()
const theme = useSettingsStore.use.theme() const theme = useSettingsStore.use.theme()
const setTheme = useSettingsStore.use.setTheme() const setTheme = useSettingsStore.use.setTheme()

View File

@@ -34,10 +34,10 @@ export default function ThemeProvider({ children, ...props }: ThemeProviderProps
root.classList.remove('light', 'dark') root.classList.remove('light', 'dark')
root.classList.add(e.matches ? 'dark' : 'light') root.classList.add(e.matches ? 'dark' : 'light')
} }
root.classList.add(mediaQuery.matches ? 'dark' : 'light') root.classList.add(mediaQuery.matches ? 'dark' : 'light')
mediaQuery.addEventListener('change', handleChange) mediaQuery.addEventListener('change', handleChange)
return () => mediaQuery.removeEventListener('change', handleChange) return () => mediaQuery.removeEventListener('change', handleChange)
} else { } else {
root.classList.add(theme) root.classList.add(theme)

View File

@@ -54,9 +54,9 @@ const GraphLabels = () => {
const setQueryLabel = useCallback((newLabel: string) => { const setQueryLabel = useCallback((newLabel: string) => {
if (newLabel.startsWith('And ') && newLabel.endsWith(' others')) return if (newLabel.startsWith('And ') && newLabel.endsWith(' others')) return
const currentLabel = useSettingsStore.getState().queryLabel const currentLabel = useSettingsStore.getState().queryLabel
if (newLabel === '*' && currentLabel === '*') { if (newLabel === '*' && currentLabel === '*') {
// When reselecting '*', just set it again to trigger a new fetch // When reselecting '*', just set it again to trigger a new fetch
useSettingsStore.getState().setQueryLabel('*') useSettingsStore.getState().setQueryLabel('*')

View File

@@ -25,7 +25,7 @@ const TooltipContent = React.forwardRef<
} }
>(({ className, side = 'left', align = 'start', children, ...props }, ref) => { >(({ className, side = 'left', align = 'start', children, ...props }, ref) => {
const contentRef = React.useRef<HTMLDivElement>(null); const contentRef = React.useRef<HTMLDivElement>(null);
React.useEffect(() => { React.useEffect(() => {
if (contentRef.current) { if (contentRef.current) {
contentRef.current.scrollTop = 0; contentRef.current.scrollTop = 0;

View File

@@ -178,8 +178,8 @@ const useLightrangeGraph = () => {
// Reset fetch status only when parameters actually change // Reset fetch status only when parameters actually change
useEffect(() => { useEffect(() => {
const prevParams = prevParamsRef.current; const prevParams = prevParamsRef.current;
if (prevParams.queryLabel !== queryLabel || if (prevParams.queryLabel !== queryLabel ||
prevParams.maxQueryDepth !== maxQueryDepth || prevParams.maxQueryDepth !== maxQueryDepth ||
prevParams.minDegree !== minDegree) { prevParams.minDegree !== minDegree) {
useGraphStore.getState().setIsFetching(false); useGraphStore.getState().setIsFetching(false);
// Reset fetch status for new parameters // Reset fetch status for new parameters
@@ -206,7 +206,7 @@ const useLightrangeGraph = () => {
useEffect(() => { useEffect(() => {
if (queryLabel) { if (queryLabel) {
const fetchKey = `${queryLabel}-${maxQueryDepth}-${minDegree}`; const fetchKey = `${queryLabel}-${maxQueryDepth}-${minDegree}`;
// Only fetch if we haven't fetched this combination in the current component lifecycle // Only fetch if we haven't fetched this combination in the current component lifecycle
if (!isFetching && !fetchStatusRef.current[fetchKey]) { if (!isFetching && !fetchStatusRef.current[fetchKey]) {
useGraphStore.getState().setIsFetching(true); useGraphStore.getState().setIsFetching(true);
@@ -215,13 +215,13 @@ const useLightrangeGraph = () => {
const state = useGraphStore.getState() const state = useGraphStore.getState()
const newSigmaGraph = createSigmaGraph(data) const newSigmaGraph = createSigmaGraph(data)
data?.buildDynamicMap() data?.buildDynamicMap()
// Update all graph data at once to minimize UI flicker // Update all graph data at once to minimize UI flicker
state.clearSelection() state.clearSelection()
state.setMoveToSelectedNode(false) state.setMoveToSelectedNode(false)
state.setSigmaGraph(newSigmaGraph) state.setSigmaGraph(newSigmaGraph)
state.setRawGraph(data) state.setRawGraph(data)
// Extract labels from graph data // Extract labels from graph data
if (data) { if (data) {
const labelSet = new Set<string>(); const labelSet = new Set<string>();

View File

@@ -129,7 +129,7 @@ const useGraphStoreBase = create<GraphState>()((set) => ({
}), }),
setSigmaGraph: (sigmaGraph: DirectedGraph | null) => set({ sigmaGraph }), setSigmaGraph: (sigmaGraph: DirectedGraph | null) => set({ sigmaGraph }),
setGraphLabels: (labels: string[]) => set({ graphLabels: labels }), setGraphLabels: (labels: string[]) => set({ graphLabels: labels }),
setMoveToSelectedNode: (moveToSelectedNode?: boolean) => set({ moveToSelectedNode }) setMoveToSelectedNode: (moveToSelectedNode?: boolean) => set({ moveToSelectedNode })