File tree Expand file tree Collapse file tree 1 file changed +11
-19
lines changed
packages/plugin-detail/src Expand file tree Collapse file tree 1 file changed +11
-19
lines changed Original file line number Diff line number Diff line change @@ -95,25 +95,17 @@ export const DetailView: React.FC<DetailViewProps> = ({
9595 setLoading ( false ) ;
9696 return ;
9797 }
98- // Fallback: if not found and resourceId starts with objectName prefix,
99- // retry with the prefix stripped (handles legacy ID conventions)
100- if ( resourceId . startsWith ( prefix ) ) {
101- const strippedId = resourceId . slice ( prefix . length ) ;
102- return dataSource . findOne ( objectName , strippedId ) . then ( ( fallbackResult ) => {
103- setData ( fallbackResult ) ;
104- setLoading ( false ) ;
105- } ) ;
106- }
107- // Fallback: if not found and resourceId does NOT have the prefix,
108- // retry with the prefix prepended (handles bare IDs)
109- if ( ! resourceId . startsWith ( prefix ) ) {
110- return dataSource . findOne ( objectName , `${ prefix } ${ resourceId } ` ) . then ( ( fallbackResult ) => {
111- setData ( fallbackResult ) ;
112- setLoading ( false ) ;
113- } ) ;
114- }
115- setData ( null ) ;
116- setLoading ( false ) ;
98+ // Fallback: try alternate ID format for backward compatibility
99+ const altId = resourceId . startsWith ( prefix )
100+ ? resourceId . slice ( prefix . length ) // strip prefix
101+ : `${ prefix } ${ resourceId } ` ; // prepend prefix
102+ return dataSource . findOne ( objectName , altId ) . then ( ( fallbackResult ) => {
103+ setData ( fallbackResult ) ;
104+ setLoading ( false ) ;
105+ } ) . catch ( ( ) => {
106+ setData ( null ) ;
107+ setLoading ( false ) ;
108+ } ) ;
117109 } ) . catch ( ( err ) => {
118110 console . error ( 'Failed to fetch detail data:' , err ) ;
119111 setLoading ( false ) ;
You can’t perform that action at this time.
0 commit comments