@@ -260,40 +260,33 @@ export const TODOSliceComponent = __PRODUCTION__
260
260
props : [ ] ,
261
261
inheritAttrs : false ,
262
262
setup ( _props , { attrs } ) {
263
- const type = computed ( ( ) =>
264
- attrs . slice && typeof attrs . slice === "object"
265
- ? "slice_type" in attrs . slice
263
+ const type = computed ( ( ) => {
264
+ // API slices
265
+ if ( attrs . slice && typeof attrs . slice === "object" ) {
266
+ return "slice_type" in attrs . slice
266
267
? ( attrs . slice as Record < string , unknown > ) . slice_type
267
- : "type" in attrs . slice
268
- ? ( attrs . slice as Record < string , unknown > ) . type
269
- : null
270
- : null ,
271
- ) ;
268
+ : ( attrs . slice as Record < string , unknown > ) . type ;
269
+ }
270
+
271
+ // Mapped slices
272
+ return "slice_type" in attrs ? attrs . slice_type : attrs . type ;
273
+ } ) ;
272
274
273
275
watchEffect ( ( ) => {
274
- type . value
275
- ? console . warn (
276
- `[SliceZone] Could not find a component for Slice type "${ type . value } "` ,
277
- attrs . slice ,
278
- )
279
- : console . warn (
280
- "[SliceZone] Could not find a component for mapped Slice" ,
281
- attrs ,
282
- ) ;
276
+ console . warn (
277
+ `[SliceZone] Could not find a component for Slice type "${ type . value } "` ,
278
+ attrs . slice || attrs ,
279
+ ) ;
283
280
} ) ;
284
281
285
282
return ( ) => {
286
283
return h (
287
284
"section" ,
288
285
{
289
286
"data-slice-zone-todo-component" : "" ,
290
- "data-slice-type" : type . value ? type . value : null ,
287
+ "data-slice-type" : type . value ,
291
288
} ,
292
- [
293
- type . value
294
- ? `Could not find a component for Slice type "${ type . value } "`
295
- : "Could not find a component for mapped Slice" ,
296
- ] ,
289
+ [ `Could not find a component for Slice type "${ type . value } "` ] ,
297
290
) ;
298
291
} ;
299
292
} ,
0 commit comments