fix(documents): surface signedFromDocumentId + hub cleanup
Three follow-ups from Task 15 code review: 1. (Important) The aggregated files API now LEFT JOINs against documents to surface signedFromDocumentId per file row. The "view signing details" button on EntityFolderView's Files section now passes the workflow id to SigningDetailsDialog instead of the file id. Previously the button always 404'd and the dialog hung in the loading state. Drops the v1 filename-prefix heuristic. 2. (Minor) Drop dead initialTab prop + DocumentsHubTab import — leftover from the pre-refactor tab strip. 3. (Minor) FlatFolderListing remounts on folder switch via a key prop, restoring the pre-refactor typeFilter reset behaviour. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,6 @@ import { PermissionGate } from '@/components/shared/permission-gate';
|
||||
import { usePaginatedQuery } from '@/hooks/use-paginated-query';
|
||||
import { useRealtimeInvalidation } from '@/hooks/use-realtime-invalidation';
|
||||
import { useDocumentFolders, type FolderNode } from '@/hooks/use-document-folders';
|
||||
import type { DocumentsHubTab } from '@/lib/validators/documents';
|
||||
import { FolderActionsMenu } from './folder-actions-menu';
|
||||
import { FolderBreadcrumb } from './folder-breadcrumb';
|
||||
import { FolderTreeSidebar } from './folder-tree-sidebar';
|
||||
@@ -64,7 +63,6 @@ const SIGNER_STATUS_LABELS: Record<string, string> = {
|
||||
|
||||
interface DocumentsHubProps {
|
||||
portSlug: string;
|
||||
initialTab?: DocumentsHubTab;
|
||||
}
|
||||
|
||||
function findInTree(nodes: FolderNode[], id: string): FolderNode | null {
|
||||
@@ -137,7 +135,7 @@ export function DocumentsHub({ portSlug }: DocumentsHubProps) {
|
||||
entityId={selectedFolder!.entityId!}
|
||||
/>
|
||||
) : (
|
||||
<FlatFolderListing portSlug={portSlug} folderId={selectedFolderId} />
|
||||
<FlatFolderListing key={selectedFolderId ?? 'root'} portSlug={portSlug} folderId={selectedFolderId} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,11 @@ import { AggregatedSection } from './aggregated-section';
|
||||
import { SigningDetailsDialog } from './signing-details-dialog';
|
||||
import { useAggregatedFiles, useAggregatedWorkflows } from '@/hooks/use-aggregated-listing';
|
||||
import { StatusPill, type StatusPillStatus } from '@/components/ui/status-pill';
|
||||
import type { AggregatedWorkflow, AggregatedFile, AggregatedGroup } from '@/hooks/use-aggregated-listing';
|
||||
import type {
|
||||
AggregatedWorkflow,
|
||||
AggregatedFile,
|
||||
AggregatedGroup,
|
||||
} from '@/hooks/use-aggregated-listing';
|
||||
|
||||
interface Props {
|
||||
portSlug: string;
|
||||
@@ -68,19 +72,17 @@ export function EntityFolderView({ portSlug, entityType, entityId }: Props) {
|
||||
loading={filesLoading}
|
||||
emptyMessage="No files for this entity yet."
|
||||
renderRow={(f: AggregatedFile, _group: AggregatedGroup<AggregatedFile>) => {
|
||||
// Heuristic v1: auto-deposit handler (Task 7) names signed files with "signed-" prefix.
|
||||
// Follow-up: surface signedFromDocumentId from the aggregated API for a principled check.
|
||||
const isSigned = f.filename?.startsWith('signed-');
|
||||
const signedFromDocumentId = f.signedFromDocumentId;
|
||||
return (
|
||||
<div className="flex items-center justify-between gap-2 text-sm">
|
||||
<span className="truncate">{f.filename}</span>
|
||||
<div className="flex items-center gap-2 text-xs text-muted-foreground tabular-nums">
|
||||
<span>{new Date(f.createdAt).toLocaleDateString('en-GB')}</span>
|
||||
{isSigned ? (
|
||||
{signedFromDocumentId ? (
|
||||
<button
|
||||
type="button"
|
||||
className="flex items-center gap-1 text-brand hover:underline"
|
||||
onClick={() => setDetailsId(f.id)}
|
||||
onClick={() => setDetailsId(signedFromDocumentId)}
|
||||
>
|
||||
<Eye className="h-3 w-3" />
|
||||
view signing details
|
||||
|
||||
Reference in New Issue
Block a user