Skip to content

Commit 40871dd

Browse files
Board examples are fetched when a board is changed
1 parent 8018f6f commit 40871dd

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎vue_webview/src/stores/useVsCodeStore.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const useVsCodeStore = defineStore('vsCode', {
5050
librariesInstalled: null as Liblist | null,
5151
boardExamples: null as Liblist | null,
5252
boardExamplesError: "" as string,
53+
boardExamplesBoard: "" as string,
5354
libariesInformation: null as LibraryInformation[] | null,
5455
additionalBoardURLs: null as string | null,
5556
outdated: null as Outdated | null,
@@ -306,7 +307,17 @@ export const useVsCodeStore = defineStore('vsCode', {
306307
handleMessage(message: WebviewToExtensionMessage) {
307308
switch (message.command) {
308309
case ARDUINO_MESSAGES.ARDUINO_PROJECT_INFO:
310+
const previousBoard = this.projectInfo?.board ?? "";
309311
this.projectInfo = message.payload;
312+
const nextBoard = this.projectInfo?.board ?? "";
313+
if (previousBoard !== nextBoard) {
314+
this.boardExamples = null;
315+
this.boardExamplesError = "";
316+
this.boardExamplesBoard = nextBoard;
317+
if (nextBoard) {
318+
this.sendMessage({ command: ARDUINO_MESSAGES.CLI_BOARD_EXAMPLES, errorMessage: "", payload: "" });
319+
}
320+
}
310321
if (this.projectInfo?.board) {
311322
this.sendMessage({ command: ARDUINO_MESSAGES.CLI_BOARD_OPTIONS, errorMessage: "", payload: this.projectInfo.board });
312323
}

0 commit comments

Comments
 (0)