@@ -82,6 +124,8 @@ function matchDynamicToBoundary(
...
@@ -82,6 +124,8 @@ function matchDynamicToBoundary(
expression:api.expression,
expression:api.expression,
layersBetween,
layersBetween,
componentsBetween,
componentsBetween,
framesBetween,
callFrame,
})
})
}
}
}
}
...
@@ -100,7 +144,7 @@ function generatePrompt(
...
@@ -100,7 +144,7 @@ function generatePrompt(
letprompt=`I have a React component structure where a Suspense boundary in "${suspenseComponent}" wraps dynamic API calls that are nested deep in the component tree. This causes more content than necessary to show loading states.\n\n`
letprompt=`I have a React component structure where a Suspense boundary in "${suspenseComponent}" wraps dynamic API calls that are nested deep in the component tree. This causes more content than necessary to show loading states.\n\n`
prompt+='Current structure:\n'
prompt+='Current structure:\n'
for(constrofdeepReasons){
for(constrofdeepReasons){
prompt+=`- ${r.expression}() is called ${r.layersBetween} layers deep: ${r.componentsBetween.join(' > ')}\n`
prompt+=`- ${r.expression} is called ${r.layersBetween} layers deep: ${r.componentsBetween.join(' > ')}\n`
}
}
prompt+=
prompt+=
'\nPlease help me move the Suspense boundary closer to the dynamic API calls to minimize the loading state area. Show me the refactored code.'
'\nPlease help me move the Suspense boundary closer to the dynamic API calls to minimize the loading state area. Show me the refactored code.'