fix: watch list do not update when creating

This commit is contained in:
jialin
2026-06-10 15:37:27 +08:00
committed by jialin
parent 6f96260993
commit 698090b17a
3 changed files with 11 additions and 17 deletions
+4 -14
View File
@@ -98,7 +98,7 @@ const ModelRoutes: React.FC = () => {
API: MODEL_ROUTES,
contentForDelete: 'menu.models.routes'
});
const { watchDataList: allRouteTargets, deleteItemFromCache } =
const { watchDataList, setWatchDataList, deleteItemFromCache } =
useWatchList(MODEL_ROUTE_TARGETS);
const [expandAtom] = useAtom(expandKeysAtom);
const {
@@ -128,6 +128,8 @@ const ModelRoutes: React.FC = () => {
);
const [modelList, setModelsList] = useState<Global.BaseOption<number>[]>([]);
console.log('dataSource', dataSource);
useEffect(() => {
const fetchModels = async () => {
try {
@@ -356,7 +358,7 @@ const ModelRoutes: React.FC = () => {
></FilterBar>
<TableProvider
value={{
allChildren: allRouteTargets,
allChildren: watchDataList,
setDisableExpand: setDisableExpand
}}
>
@@ -429,11 +431,6 @@ const ModelRoutes: React.FC = () => {
onClose={closeViewAPIInfo}
></APIAccessInfoModal>
<DeleteModal ref={modalRef}></DeleteModal>
{/* One mount per registered action. Each mount calls its
entry's `useCreate` (single hook per component, so iterating
the plugin list doesn't violate the Rules of Hooks),
renders the form, and registers its controller so dropdown
clicks can dispatch to it. */}
{configActions.map((action) => (
<ModelRouteConfigActionMount
key={action.key}
@@ -442,13 +439,6 @@ const ModelRoutes: React.FC = () => {
onOk={handleConfigActionOk}
/>
))}
{/* Page-level data lifecycle for plugin-contributed extra
columns. Receives the current list of visible route ids so
the plugin can bulk-fetch their per-user defaults in one
call (used by the quota-default column cells); `refreshToken`
bumps after a per-row save so derived page data refetches
even when the row set is unchanged. Renders nothing when no
plugin is registered. */}
<PluginExtraFields name="ModelRoutesPageGlobal" context={pluginContext} />
</>
);