AI continues to use unsupported React libraries while creating a component
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3564656. --> Reported by: [kunal.sachdev](https://www.drupal.org/user/3685163) Related to !441 >>> <h3 id="overview">Overview</h3> <p>In <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3548637" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3548637</a></span>, a fix was implemented to provide the AI with context regarding the specific libraries available within Canvas. The intention was to restrict the AI to only use these supported libraries.</p> <p>However, the AI continues to import external/unsupported libraries (e.g., when prompted to "render unsafe HTML safely," it attempts to import dompurify). This causes the preview to fail to load. This issue serves as a follow-up to system instructions to ensure the AI strictly adheres to the provided library context.</p> <h3 id="proposed-resolution">Steps to reproduce</h3> <ol> <li>Enter the prompt: "Create a component that renders unsafe HTML content safely."</li> <li>Observe the generated code includes an import statement for an external library.</li> <li>Observe the preview failing to render.</li> </ol> <h3 id="ui-changes">User interface changes</h3>
issue