Skip to content

Commit

Permalink
Revert "fix: i18n reference to root causes memory leak (#1044) (#1151)"
Browse files Browse the repository at this point in the history
This reverts commit ca4e11a.
  • Loading branch information
kazupon authored Apr 28, 2021
1 parent 7bfd750 commit 331dbd6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 47 deletions.
10 changes: 0 additions & 10 deletions src/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,6 @@ export default {
options.i18n.silentFallbackWarn = rootI18n.silentFallbackWarn
options.i18n.pluralizationRules = rootI18n.pluralizationRules
options.i18n.preserveDirectiveContent = rootI18n.preserveDirectiveContent
this.$root.$once('hook:beforeDestroy', () => {
options.i18n.root = null;
options.i18n.formatter = null;
options.i18n.fallbackLocale = null;
options.i18n.formatFallbackMessages = null;
options.i18n.silentTranslationWarn = null;
options.i18n.silentFallbackWarn = null;
options.i18n.pluralizationRules = null;
options.i18n.preserveDirectiveContent = null;
});
}

// init locale messages via custom blocks
Expand Down
37 changes: 0 additions & 37 deletions test/unit/issues.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import messages from './fixture/index'
import { parse } from '../../src/format'
import VueI18n from '../../src'
import { Vue } from '../../src/install'
const compiler = require('vue-template-compiler')

const delay = time => new Promise(resolve => setTimeout(resolve, time))
Expand Down Expand Up @@ -499,42 +498,6 @@ describe('issues', () => {
}).then(done)
})
})
// 1044
describe('#1044', () => {
it('should be free memory', done => {
const i18n = {
messages: {
hello: 'hello world!'
}
}
const Test = {
i18n,
}
const vm = new Vue({
components: {
Test
},
i18n: {
locale: 'en',
},
render (h) {
return h('Test')
}
}).$mount()
vm.$destroy();

assert.strictEqual(i18n.root, null)
assert.strictEqual(i18n.formatter, null)
assert.strictEqual(i18n.fallbackLocale, null)
assert.strictEqual(i18n.formatFallbackMessages, null)
assert.strictEqual(i18n.silentTranslationWarn, null)
assert.strictEqual(i18n.silentFallbackWarn, null)
assert.strictEqual(i18n.pluralizationRules, null)
assert.strictEqual(i18n.preserveDirectiveContent, null)

done();
});
})

describe('#78, #464', () => {
it('should fallback to default pluralization', () => {
Expand Down

0 comments on commit 331dbd6

Please sign in to comment.