fix(editor): Task 6 round 1, draft store tests, dead rescue
This commit is contained in:
1 parent
f0e49fd447
commit
270444e2ec
4 files changed
+66
-4
No files matched your search
@@ -200,7 +200,8 @@ function useEditForm(props: FindingEditFormProps) {
|
||||
|
||||
/**
|
||||
* The element edited in the finding dialog (R2F-3): a local draft, one `update` on
|
||||
* « Enregistrer », citations included (none when nothing changed), nothing on « Annuler » or a close. When the
|
||||
* « Enregistrer », citations included (none when nothing changed), nothing on « Annuler »
|
||||
* or a close. When the
|
||||
* editor turns read-only the draft stays, its fields read-only, and only « Abandonner »
|
||||
* is left.
|
||||
*/
|
||||
|
||||
@@ -177,7 +177,8 @@ function Entries({ panel, props }: { panel: Panel; props: Props }) {
|
||||
|
||||
/**
|
||||
* The citations of one finding: the references it cites as tiles, « Tout afficher » for
|
||||
* the whole library. No search, add, remove or order (P7): citing is the edit form's. The content of the side sheet
|
||||
* the whole library. No search, add, remove or order (P7): citing is the edit form's.
|
||||
* The content of the side sheet
|
||||
* (CitationsSheet), which is the modal; opens from a finding's trigger only.
|
||||
*/
|
||||
export default function CitationsPanel(props: Props) {
|
||||
|
||||
@@ -12,6 +12,9 @@ interface CitationDraftStore {
|
||||
publish: (draft: CitationDraft | null) => void
|
||||
}
|
||||
|
||||
// shortcut: module-level store because the citations sheet is a sibling of the finding
|
||||
// dialog, so no React context reaches both. It holds one draft at a time (one edit form
|
||||
// is open at once). Upgrade path: a provider above the dialog and the sheet.
|
||||
export const useCitationDraft = create<CitationDraftStore>((set) => ({
|
||||
draft: null,
|
||||
publish: (draft) => set({ draft }),
|
||||
|
||||
Reference in new issue
Block a user