@@ -47,7 +47,8 @@ export default Component.extend({
47
47
if ( ! this . get ( 'filterData.showDeprecated' ) ) {
48
48
items = items . filter ( item => item . deprecated !== true ) ;
49
49
}
50
- return _ . uniq ( _ . sortBy ( items , 'name' ) , true , ( item => item . name ) ) ;
50
+ let sortedUniqueItems = _ . uniq ( _ . sortBy ( items , 'name' ) , true , ( item => item . name ) ) ;
51
+ return this . filterMultipleInheritance ( sortedUniqueItems )
51
52
} ,
52
53
53
54
filteredData : computed ( 'filteredMethods' , 'filteredProperties' , 'filteredEvents' , function ( ) {
@@ -56,6 +57,24 @@ export default Component.extend({
56
57
properties : this . get ( 'filteredProperties' ) ,
57
58
events : this . get ( 'filteredEvents' )
58
59
} ;
59
- } )
60
+ } ) ,
60
61
61
- } ) ;
62
+ /**
63
+ * Show the most local property if there are duplicate properties of the same name.
64
+ * The docs for the nearest inheritance are typically more helpful to users.
65
+ * Ember-jsonapi-docs returns a mix of inherited/local, but once sorted, the
66
+ * first item in the list is "most local."
67
+ * @method filterMultipleInheritance
68
+ */
69
+ filterMultipleInheritance ( items ) {
70
+ return items . filter ( function ( item , index , arr ) {
71
+ if ( index === 0 ) {
72
+ return true ;
73
+ } else if ( item . name === arr [ index - 1 ] . name ) {
74
+ return false ;
75
+ } else {
76
+ return true ;
77
+ }
78
+ } )
79
+ }
80
+ } )
0 commit comments