mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-13 22:46:07 +08:00
### What problem does this PR solve? fix: Bulk disable the chunk, the UI still shows they are enabled #1236 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
75086f41a9
commit
266119bf62
@ -3,7 +3,7 @@ import { IChunk } from '@/interfaces/database/knowledge';
|
|||||||
import { Card, Checkbox, CheckboxProps, Flex, Popover, Switch } from 'antd';
|
import { Card, Checkbox, CheckboxProps, Flex, Popover, Switch } from 'antd';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import DOMPurify from 'dompurify';
|
import DOMPurify from 'dompurify';
|
||||||
import { useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
import { ChunkTextMode } from '../../constant';
|
import { ChunkTextMode } from '../../constant';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
@ -30,7 +30,7 @@ const ChunkCard = ({
|
|||||||
textMode,
|
textMode,
|
||||||
}: IProps) => {
|
}: IProps) => {
|
||||||
const available = Number(item.available_int);
|
const available = Number(item.available_int);
|
||||||
const [enabled, setEnabled] = useState(available === 1);
|
const [enabled, setEnabled] = useState(false);
|
||||||
|
|
||||||
const onChange = (checked: boolean) => {
|
const onChange = (checked: boolean) => {
|
||||||
setEnabled(checked);
|
setEnabled(checked);
|
||||||
@ -49,6 +49,10 @@ const ChunkCard = ({
|
|||||||
clickChunkCard(item.chunk_id);
|
clickChunkCard(item.chunk_id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setEnabled(available === 1);
|
||||||
|
}, [available]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
className={classNames(styles.chunkCard, {
|
className={classNames(styles.chunkCard, {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user