fix: Stop enqueuing document analysis job when only title changes
This commit is contained in:
@@ -1218,27 +1218,6 @@ impl<'a> DocumentsService<'a> {
|
||||
.find(document.current_version_id)
|
||||
.first(conn)?;
|
||||
|
||||
if title_changed {
|
||||
if let Err(err) = enqueue_job(
|
||||
conn,
|
||||
tenant_id,
|
||||
JOB_ANALYZE_DOCUMENT,
|
||||
json!({
|
||||
"document_id": document.id,
|
||||
"document_version_id": current_version.id,
|
||||
"force": false,
|
||||
}),
|
||||
None,
|
||||
) {
|
||||
warn!(
|
||||
document_id = %document.id,
|
||||
version_id = %current_version.id,
|
||||
error = %err,
|
||||
"failed to enqueue analyze job after title change"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let tags_and_correspondents = load_tags_and_correspondents(conn, &[document_id])?;
|
||||
let version_id = current_version.id;
|
||||
let assets = self.load_asset_responses(conn, tenant_id, version_id, user_id)?;
|
||||
|
||||
@@ -70,6 +70,26 @@ const AbstractDocumentsView = <CProps extends { clearSelection: () => void; chil
|
||||
ensureFocusedEntryVisible();
|
||||
}, [ensureFocusedEntryVisible]);
|
||||
|
||||
const { detailPanelOpen } = usePanelManager();
|
||||
|
||||
useEffect(() => {
|
||||
const container = scrollRef?.current;
|
||||
if (!container) return;
|
||||
|
||||
const handleTransitionEnd = () => {
|
||||
ensureFocusedEntryVisible();
|
||||
};
|
||||
|
||||
container.addEventListener('transitionend', handleTransitionEnd);
|
||||
|
||||
// Immediate check in case there is no transition or it finished already
|
||||
ensureFocusedEntryVisible();
|
||||
|
||||
return () => {
|
||||
container.removeEventListener('transitionend', handleTransitionEnd);
|
||||
};
|
||||
}, [scrollRef, ensureFocusedEntryVisible, detailPanelOpen]);
|
||||
|
||||
return (
|
||||
<ContainerComponent
|
||||
clearSelection={clearSelection}
|
||||
|
||||
Reference in New Issue
Block a user