Skip to content

Commit cc99a3b

Browse files
committed
Fix: Use correct method to uninstall plugins during rollback
The rollback called `this.contentplugin.uninstallPlugin()` which does not exist on ContentPluginModule. The correct method is `delete()`. This caused a TypeError that masked the original import error and prevented proper cleanup of newly installed plugins.
1 parent 162fd53 commit cc99a3b

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib/AdaptFrameworkImport.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ class AdaptFrameworkImport {
881881
// Uninstall newly installed plugins
882882
if (this.contentplugin) {
883883
tasks.push(...Object.values(this.newContentPlugins).map(p =>
884-
this.contentplugin.uninstallPlugin(p._id)
884+
this.contentplugin.delete({ _id: p._id })
885885
.catch(e => log('warn', `failed to uninstall plugin '${p.name}'`, e))
886886
))
887887
}

tests/AdaptFrameworkImport.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ describe('AdaptFrameworkImport', () => {
416416
const uninstalled = []
417417
const ctx = makeRollbackCtx({
418418
contentplugin: {
419-
uninstallPlugin: async (id) => uninstalled.push(id)
419+
delete: async ({ _id }) => uninstalled.push(_id)
420420
},
421421
newContentPlugins: {
422422
'adapt-contrib-text': { _id: 'p1', name: 'adapt-contrib-text' },
@@ -515,9 +515,9 @@ describe('AdaptFrameworkImport', () => {
515515
const uninstalled = []
516516
const ctx = makeRollbackCtx({
517517
contentplugin: {
518-
uninstallPlugin: async (id) => {
519-
if (id === 'p1') throw new Error('uninstall failed')
520-
uninstalled.push(id)
518+
delete: async ({ _id }) => {
519+
if (_id === 'p1') throw new Error('uninstall failed')
520+
uninstalled.push(_id)
521521
}
522522
},
523523
newContentPlugins: {

0 commit comments

Comments
 (0)