@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.cjs CHANGED
@@ -2886,7 +2886,9 @@ function ImageFieldControl({
2886
2886
  const [busy, setBusy] = react$1.useState(false);
2887
2887
  const arbi = react.useArbi();
2888
2888
  const gen = useImageGen();
2889
+ const queryClient = reactQuery.useQueryClient();
2889
2890
  const tp = (...q) => tid(`${testIdPrefix}-image`, name, ...q);
2891
+ const refreshAssets = () => queryClient.invalidateQueries({ queryKey: ["arbi", "documents", workspaceId] });
2890
2892
  const { data: docs } = react.useDocuments(workspaceId);
2891
2893
  const imageDocs = react$1.useMemo(
2892
2894
  () => (docs ?? []).filter(
@@ -2907,7 +2909,10 @@ function ImageFieldControl({
2907
2909
  await arbi.selectWorkspace(workspaceId);
2908
2910
  const res = await arbi.documents.uploadFile(file, file.name, { folder });
2909
2911
  const id = res.doc_ext_ids?.[0];
2910
- if (id) onChange(asAssetRef(id));
2912
+ if (id) {
2913
+ onChange(asAssetRef(id));
2914
+ void refreshAssets();
2915
+ }
2911
2916
  } finally {
2912
2917
  setBusy(false);
2913
2918
  }
@@ -2915,7 +2920,10 @@ function ImageFieldControl({
2915
2920
  const onGenerate = async () => {
2916
2921
  if (!prompt.trim() || gen.isGenerating) return;
2917
2922
  const id = await gen.generate(prompt);
2918
- if (id) onChange(asAssetRef(id));
2923
+ if (id) {
2924
+ onChange(asAssetRef(id));
2925
+ void refreshAssets();
2926
+ }
2919
2927
  };
2920
2928
  const MODES = [
2921
2929
  { key: "asset", label: "Assets", icon: lucideReact.ImagePlus },