Merge branch 'main' into multi-language
This commit is contained in:
@@ -40,18 +40,21 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean })
|
||||
const focusedEdge = useGraphStore.use.focusedEdge()
|
||||
|
||||
/**
|
||||
* When component mount
|
||||
* => load the graph
|
||||
* When component mount or maxIterations changes
|
||||
* => load the graph and apply layout
|
||||
*/
|
||||
useEffect(() => {
|
||||
// Create & load the graph
|
||||
const graph = lightrageGraph()
|
||||
loadGraph(graph)
|
||||
if (!(graph as any).__force_applied) {
|
||||
assignLayout()
|
||||
Object.assign(graph, { __force_applied: true })
|
||||
}
|
||||
assignLayout()
|
||||
}, [assignLayout, loadGraph, lightrageGraph, maxIterations])
|
||||
|
||||
/**
|
||||
* When component mount
|
||||
* => register events
|
||||
*/
|
||||
useEffect(() => {
|
||||
const { setFocusedNode, setSelectedNode, setFocusedEdge, setSelectedEdge, clearSelection } =
|
||||
useGraphStore.getState()
|
||||
|
||||
@@ -87,7 +90,7 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean })
|
||||
},
|
||||
clickStage: () => clearSelection()
|
||||
})
|
||||
}, [assignLayout, loadGraph, registerEvents, lightrageGraph])
|
||||
}, [registerEvents])
|
||||
|
||||
/**
|
||||
* When component mount or hovered node change
|
||||
|
@@ -91,9 +91,12 @@ const LabeledNumberInput = ({
|
||||
{label}
|
||||
</label>
|
||||
<Input
|
||||
value={currentValue || ''}
|
||||
type="number"
|
||||
value={currentValue === null ? '' : currentValue}
|
||||
onChange={onValueChange}
|
||||
className="h-6 w-full min-w-0"
|
||||
className="h-6 w-full min-w-0 pr-1"
|
||||
min={min}
|
||||
max={max}
|
||||
onBlur={onBlur}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
@@ -120,6 +123,7 @@ export default function Settings() {
|
||||
const enableHideUnselectedEdges = useSettingsStore.use.enableHideUnselectedEdges()
|
||||
const showEdgeLabel = useSettingsStore.use.showEdgeLabel()
|
||||
const graphQueryMaxDepth = useSettingsStore.use.graphQueryMaxDepth()
|
||||
const graphMinDegree = useSettingsStore.use.graphMinDegree()
|
||||
const graphLayoutMaxIterations = useSettingsStore.use.graphLayoutMaxIterations()
|
||||
|
||||
const enableHealthCheck = useSettingsStore.use.enableHealthCheck()
|
||||
@@ -178,6 +182,11 @@ export default function Settings() {
|
||||
useSettingsStore.setState({ graphQueryMaxDepth: depth })
|
||||
}, [])
|
||||
|
||||
const setGraphMinDegree = useCallback((degree: number) => {
|
||||
if (degree < 0) return
|
||||
useSettingsStore.setState({ graphMinDegree: degree })
|
||||
}, [])
|
||||
|
||||
const setGraphLayoutMaxIterations = useCallback((iterations: number) => {
|
||||
if (iterations < 1) return
|
||||
useSettingsStore.setState({ graphLayoutMaxIterations: iterations })
|
||||
@@ -274,7 +283,7 @@ export default function Settings() {
|
||||
min={0}
|
||||
value={graphMinDegree}
|
||||
onEditFinished={setGraphMinDegree}
|
||||
/>
|
||||
/>
|
||||
<LabeledNumberInput
|
||||
label={t("graphPanel.sideBar.settings.maxLayoutIterations")}
|
||||
min={1}
|
||||
@@ -282,7 +291,6 @@ export default function Settings() {
|
||||
value={graphLayoutMaxIterations}
|
||||
onEditFinished={setGraphLayoutMaxIterations}
|
||||
/>
|
||||
|
||||
<Separator />
|
||||
|
||||
<div className="flex flex-col gap-2">
|
||||
|
Reference in New Issue
Block a user