Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Infiniflow Ragflow Simple History Util

From Leeroopedia
Revision as of 11:22, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Infiniflow_Ragflow_Simple_History_Util.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Frontend, Routing, Infrastructure
Last Updated 2026-02-12 06:00 GMT

Overview

Concrete lightweight browser history management abstraction with event listener support for programmatic navigation in the RAGFlow frontend.

Description

The utils/simple-history-util.ts module provides a framework-agnostic browser history wrapper with push, replace, go, back, forward methods and a listener system for reacting to navigation changes. It wraps the browser History API with additional state tracking.

Usage

Import this utility for programmatic navigation in contexts outside React Router, such as HTTP interceptors or standalone utility functions.

Code Reference

Source Location

Signature

export const history: {
  push(path: string, state?: any): void;
  replace(path: string, state?: any): void;
  go(n: number): void;
  back(): void;
  forward(): void;
  listen(callback: (location: Location) => void): () => void;
  location: Location;
};

Import

import { history } from '@/utils/simple-history-util';

I/O Contract

Inputs

Name Type Required Description
path string Yes Navigation target path
state any No History state object

Outputs

Name Type Description
history.location Location Current browser location
listen() returns function Unsubscribe function

Usage Examples

import { history } from '@/utils/simple-history-util';

// Redirect to login from interceptor
history.push('/login');

// Listen for navigation
const unlisten = history.listen((location) => {
  console.log('Navigated to:', location.pathname);
});

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment