Skip to content

Commit

Permalink
handle getCache returning non-array
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Twydell <[email protected]>
  • Loading branch information
AndrewTwydell committed Jan 9, 2025
1 parent 66bd014 commit c06fa9e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/vsce/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to the "cics-extension-for-zowe" extension will be documente
## Recent Changes

- BugFix: Remove create profile gif from readme. [#33](https://github.com/zowe/cics-for-zowe-client/issues/33)
- BugFix: Handle getCache returning non-array. [#178](https://github.com/zowe/cics-for-zowe-client/issues/178)

## `3.2.4`

Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/utils/commandUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ export function splitCmciErrorMessage(message: any) {
return [resp, resp2, respAlt, eibfnAlt];
}

export function toArray<T>(input: T | [T]): [T] {
export function toArray<T>(input: T | T[]): T[] {
return Array.isArray(input) ? input : [input];
}
14 changes: 8 additions & 6 deletions packages/vsce/src/utils/profileManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,14 @@ export class ProfileManagement {
if (isPlex) {
try {
const { response } = await getCache(session, { cacheToken: isPlex, nodiscard: false });
for (const plex of response.records.cicscicsplex || []) {
infoLoaded.push({
plexname: plex.plexname,
regions: [],
group: false,
});
if (response.records.cicscicsplex) {
for (const plex of toArray(response.records.cicscicsplex)) {
infoLoaded.push({
plexname: plex.plexname,
regions: [],
group: false,
});
}
}
} catch (error) {
window.showErrorMessage(
Expand Down

0 comments on commit c06fa9e

Please sign in to comment.