-
-
Notifications
You must be signed in to change notification settings - Fork 235
Closed
Description
Problem
Currently, documentTitle is captured at hook initialization time, making it impossible to set dynamic filenames (e.g., with timestamps) without recreating the hook.
Use Case
Users need to include timestamps or other dynamic data in the print filename:
- Invoice with current date:
Invoice_2026-02-02.pdf - Report with generation time:
Report_14-30-25.pdf - B/L draft with timestamp:
BILL_OF_LADING_DRAFT_2026-02-02_09-30.pdf
Current Workaround
Users must either:
- Accept static filenames (loses timestamp info)
- Recreate the hook on every state change (performance issue)
- Violate React Hooks rules by conditionally calling hooks
Proposed Solution
Support function callbacks for documentTitle:
// Option 1: Allow function type
documentTitle?: string | (() => string);
// Option 2: Add new parameter
getDocumentTitle?: () => string;
Implementation
I'm willing to submit a PR for this feature. Would the maintainers be open to:
- Option 1 (extend existing parameter)
- Option 2 (add new parameter)
- Alternative approach?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels