@@ -23,13 +23,8 @@ import { useSecondaryNavigation } from "../../hooks/useSecondaryNavigation";
23
23
* Allows viewing, adding and removing destruction list items.
24
24
*/
25
25
export function DestructionListEdit ( ) {
26
- const {
27
- destructionList,
28
- destructionListItems,
29
- review,
30
- selectableZaken,
31
- storageKey,
32
- } = useLoaderData ( ) as DestructionListDetailContext ;
26
+ const { destructionList, destructionListItems, selectableZaken, storageKey } =
27
+ useLoaderData ( ) as DestructionListDetailContext ;
33
28
34
29
const [ selectionClearedState , setSelectionClearedState ] = useState ( false ) ;
35
30
const { state } = useNavigation ( ) ;
@@ -39,8 +34,10 @@ export function DestructionListEdit() {
39
34
40
35
// Whether the list is in edit mode.
41
36
const editingState = useMemo (
42
- ( ) => ! review && Boolean ( urlSearchParams . get ( "is_editing" ) ) ,
43
- [ review , urlSearchParams ] ,
37
+ ( ) =>
38
+ destructionList . status === "new" &&
39
+ Boolean ( urlSearchParams . get ( "is_editing" ) ) ,
40
+ [ destructionList . status , urlSearchParams ] ,
44
41
) ;
45
42
46
43
// The initially select items.
@@ -116,18 +113,20 @@ export function DestructionListEdit() {
116
113
onClick : ( ) => handleSetEditing ( false ) ,
117
114
} ,
118
115
]
119
- : [
120
- {
121
- children : (
122
- < >
123
- < Solid . PencilIcon />
124
- Bewerken
125
- </ >
126
- ) ,
127
- wrap : false ,
128
- onClick : ( ) => handleSetEditing ( true ) ,
129
- } ,
130
- ] ,
116
+ : destructionList . status === "new"
117
+ ? [
118
+ {
119
+ children : (
120
+ < >
121
+ < Solid . PencilIcon />
122
+ Bewerken
123
+ </ >
124
+ ) ,
125
+ wrap : false ,
126
+ onClick : ( ) => handleSetEditing ( true ) ,
127
+ } ,
128
+ ]
129
+ : [ ] ,
131
130
[ editingState , state ] ,
132
131
) ;
133
132
0 commit comments