Skip to content

Commit

Permalink
Fix webview crashing bug if project name input isn't cleared on time
Browse files Browse the repository at this point in the history
Signed-off-by: paulober <[email protected]>
  • Loading branch information
paulober committed Sep 6, 2024
1 parent f8f76a8 commit aa79457
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/webview/newProjectPanel.mts
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,7 @@ export class NewProjectPanel {
forceCreateFromExample
? "Select an example"
: "Project name"
}" required/>
}" required/> <!-- without this required the webview will crash every time you hit the examples button -->
<button id="project-name-dropdown-button" class="absolute inset-y-0 right-0 flex items-center px-2 border border-l-0 bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-white rounded-r-lg border-gray-300 dark:border-gray-600 ${
!forceCreateFromExample ? "hidden" : ""
}">&#9660;</button>
Expand Down
3 changes: 3 additions & 0 deletions web/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ window.toggleCreateFromExampleMode = function (forceOn, forceOff) {
const defaultBoardTypeOption = document.getElementById('sel-default');

if (isExampleMode && (forceOn === undefined || !forceOn) && (forceOff === undefined || forceOff)) {
// clear input to avoid crashing the webview
projectNameInput.value = '';

if (createFromExampleBtn) {
createFromExampleBtn.setAttribute('data-example-mode', 'false');
createFromExampleBtn.innerText = 'Example';
Expand Down

0 comments on commit aa79457

Please sign in to comment.