@@ -201,7 +201,19 @@ export class EditDocumentComponent implements OnInit, DirtyFormGuardComponent {
201201 hoverSchemaPath = signal < string [ ] | undefined > ( undefined ) ;
202202 hoverSchemaField = signal < string | undefined > ( undefined ) ;
203203 clickSchemaField = signal < string | undefined > ( undefined ) ;
204- schemaPath = signal < SchemaPathItem [ ] > ( [ ] ) ;
204+ schemaPath = linkedSignal < SchemaPathItem [ ] > ( ( ) => {
205+ const rootSchema = this . rootSchema ( ) ;
206+ if ( rootSchema ) {
207+ return [
208+ {
209+ contentId : this . documentData . _id ,
210+ schemaName : this . documentData . schema ,
211+ fieldName : '' ,
212+ } ,
213+ ] ;
214+ }
215+ return [ ] ;
216+ } ) ;
205217 isSamePath = computed ( ( ) => {
206218 const uiPath = this . schemaPath ( ) . map ( it => it . contentId ) ;
207219 return ObjectUtils . isEqual ( uiPath , this . hoverSchemaPath ( ) ) ;
@@ -246,19 +258,8 @@ export class EditDocumentComponent implements OnInit, DirtyFormGuardComponent {
246258 } else {
247259 this . documentData = ObjectUtils . clone ( document . data ) ;
248260 }
261+ this . selectedDocumentData = this . documentData ;
249262 }
250- // Generate initial path only once
251- if ( this . rootSchema ( ) && this . schemaPath ( ) . length == 0 ) {
252- this . schemaPath . set ( [
253- {
254- contentId : this . documentData . _id ,
255- schemaName : this . documentData . schema ,
256- fieldName : '' ,
257- } ,
258- ] ) ;
259- }
260- // Select content base on path
261- this . navigateToSchemaBackwards ( this . schemaPath ( ) [ this . schemaPath ( ) . length - 1 ] ) ;
262263 this . generateDocumentIdsTree ( ) ;
263264 }
264265
@@ -420,7 +421,7 @@ export class EditDocumentComponent implements OnInit, DirtyFormGuardComponent {
420421
421422 navigateToSchemaBackwards ( pathItem : SchemaPathItem ) : void {
422423 //console.group('navigateToSchemaBackwards');
423- // console.log('pathItem', pathItem);
424+ console . log ( 'pathItem' , pathItem ) ;
424425 const idx = this . schemaPath ( ) . findIndex ( it => it . contentId == pathItem . contentId ) ;
425426 this . schemaPath . update ( it => {
426427 it . splice ( idx + 1 ) ;
0 commit comments