@arbidocs/blocks 0.3.113 → 0.3.114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { MessageSquare, Cpu, Code, Cloud, Layers, Target, Award, MapPin, Phone,
5
5
  import { Input, Card, CardHeader, CardTitle, CardContent, useArbi, ArbiProvider, useAiTask, useWorkspaceDocs as useWorkspaceDocs$1, useSemanticSearch as useSemanticSearch$1, cn, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, Button, Avatar, AvatarImage, AvatarFallback, AiMarkdown, Badge, Switch, useConfigs, useAgents, Checkbox, Tabs as Tabs$1, TabsList, TabsTrigger, TabsContent, Separator, ArbiWebSocketProvider, useDocuments, useThumbnails } from '@arbidocs/react';
6
6
  export { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, redlineStats, textToArtifact, toRedlineMarkdown } from '@arbidocs/react';
7
7
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
8
- import { QueryClient, QueryClientProvider, useQuery } from '@tanstack/react-query';
8
+ import { QueryClient, QueryClientProvider, useQuery, useQueryClient } from '@tanstack/react-query';
9
9
  import { AgGridReact } from 'ag-grid-react';
10
10
  import { themeQuartz, AllCommunityModule } from 'ag-grid-community';
11
11
  import { Link, useParams } from 'react-router-dom';
@@ -2885,7 +2885,9 @@ function ImageFieldControl({
2885
2885
  const [busy, setBusy] = useState(false);
2886
2886
  const arbi = useArbi();
2887
2887
  const gen = useImageGen();
2888
+ const queryClient = useQueryClient();
2888
2889
  const tp = (...q) => tid(`${testIdPrefix}-image`, name, ...q);
2890
+ const refreshAssets = () => queryClient.invalidateQueries({ queryKey: ["arbi", "documents", workspaceId] });
2889
2891
  const { data: docs } = useDocuments(workspaceId);
2890
2892
  const imageDocs = useMemo(
2891
2893
  () => (docs ?? []).filter(
@@ -2906,7 +2908,10 @@ function ImageFieldControl({
2906
2908
  await arbi.selectWorkspace(workspaceId);
2907
2909
  const res = await arbi.documents.uploadFile(file, file.name, { folder });
2908
2910
  const id = res.doc_ext_ids?.[0];
2909
- if (id) onChange(asAssetRef(id));
2911
+ if (id) {
2912
+ onChange(asAssetRef(id));
2913
+ void refreshAssets();
2914
+ }
2910
2915
  } finally {
2911
2916
  setBusy(false);
2912
2917
  }
@@ -2914,7 +2919,10 @@ function ImageFieldControl({
2914
2919
  const onGenerate = async () => {
2915
2920
  if (!prompt.trim() || gen.isGenerating) return;
2916
2921
  const id = await gen.generate(prompt);
2917
- if (id) onChange(asAssetRef(id));
2922
+ if (id) {
2923
+ onChange(asAssetRef(id));
2924
+ void refreshAssets();
2925
+ }
2918
2926
  };
2919
2927
  const MODES = [
2920
2928
  { key: "asset", label: "Assets", icon: ImagePlus },