Fix Reactivity issue with library imports when changing version
This commit is contained in:
@@ -9,7 +9,7 @@ export type ImportedLib = {
|
||||
export type XOCashLibs = {
|
||||
'@xocash/stack': ImportedLib;
|
||||
'@xocash/primitives': ImportedLib;
|
||||
}
|
||||
};
|
||||
|
||||
const xocashLibs = reactive<XOCashLibs>({
|
||||
'@xocash/stack': {
|
||||
@@ -64,8 +64,14 @@ export const useXOCashLibs = (): XOCashLibs => {
|
||||
// Fetch the versions and set the selected version when the component is mounted.
|
||||
onMounted(async () => {
|
||||
xocashLibs['@xocash/stack'].versions = await getVersions();
|
||||
xocashLibs['@xocash/stack'].selectedVersion =
|
||||
xocashLibs['@xocash/stack'].versions[xocashLibs['@xocash/stack'].versions.length - 1];
|
||||
|
||||
// Only update the selected version if it is not already set.
|
||||
if (!xocashLibs['@xocash/stack'].selectedVersion) {
|
||||
xocashLibs['@xocash/stack'].selectedVersion =
|
||||
xocashLibs['@xocash/stack'].versions[
|
||||
xocashLibs['@xocash/stack'].versions.length - 1
|
||||
];
|
||||
}
|
||||
});
|
||||
|
||||
return xocashLibs;
|
||||
|
||||
Reference in New Issue
Block a user