A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/bootstrap-vue/bootstrap-vue/commit/e67d34190358cb5e9d3e6d45ec74f045bf20caef below:

component destroy handling on parent destroy (#5749) · bootstrap-vue/bootstrap-vue@e67d341 · GitHub

File tree Expand file treeCollapse file tree 4 files changed

+34

-18

lines changed

Filter options

Expand file treeCollapse file tree 4 files changed

+34

-18

lines changed Original file line number Diff line number Diff line change

@@ -2,6 +2,7 @@

2 2

import { BModal, props as modalProps } from '../modal'

3 3

import { concat } from '../../../utils/array'

4 4

import { getComponentConfig } from '../../../utils/config'

5 +

import { requestAF } from '../../../utils/dom'

5 6

import { isUndefined, isFunction } from '../../../utils/inspect'

6 7

import {

7 8

assign,

@@ -69,10 +70,11 @@ const plugin = Vue => {

69 70

mounted() {

70 71

// Self destruct handler

71 72

const handleDestroy = () => {

72 -

const self = this

73 73

this.$nextTick(() => {

74 -

// In a `setTimeout()` to release control back to application

75 -

setTimeout(() => self.$destroy(), 0)

74 +

// In a `requestAF()` to release control back to application

75 +

requestAF(() => {

76 +

this.$destroy()

77 +

})

76 78

})

77 79

}

78 80

// Self destruct if parent destroyed

Original file line number Diff line number Diff line change

@@ -63,18 +63,17 @@ const plugin = Vue => {

63 63

}

64 64

},

65 65

mounted() {

66 -

const self = this

67 66

// Self destruct handler

68 67

const handleDestroy = () => {

69 68

// Ensure the toast has been force hidden

70 -

self.localShow = false

71 -

self.doRender = false

72 -

self.$nextTick(() => {

73 -

self.$nextTick(() => {

69 +

this.localShow = false

70 +

this.doRender = false

71 +

this.$nextTick(() => {

72 +

this.$nextTick(() => {

74 73

// In a `requestAF()` to release control back to application

75 74

// and to allow the portal-target time to remove the content

76 75

requestAF(() => {

77 -

self.$destroy()

76 +

this.$destroy()

78 77

})

79 78

})

80 79

})

@@ -86,7 +85,7 @@ const plugin = Vue => {

86 85

// Self destruct when toaster is destroyed

87 86

this.listenOnRoot('bv::toaster::destroyed', toaster => {

88 87

/* istanbul ignore next: hard to test */

89 -

if (toaster === self.toaster) {

88 +

if (toaster === this.toaster) {

90 89

handleDestroy()

91 90

}

92 91

})

Original file line number Diff line number Diff line change

@@ -7,7 +7,7 @@

7 7 8 8

import Vue from '../../../utils/vue'

9 9

import Popper from 'popper.js'

10 -

import { getCS, select } from '../../../utils/dom'

10 +

import { getCS, requestAF, select } from '../../../utils/dom'

11 11

import { toFloat } from '../../../utils/number'

12 12

import { HTMLElement, SVGElement } from '../../../utils/safe-types'

13 13

import { BVTransition } from '../../../utils/bv-transition'

@@ -139,12 +139,19 @@ export const BVPopper = /*#__PURE__*/ Vue.extend({

139 139

this.$on('show', el => {

140 140

this.popperCreate(el)

141 141

})

142 -

// Self destruct once hidden

143 -

this.$on('hidden', () => {

144 -

this.$nextTick(this.$destroy)

145 -

})

146 -

// If parent is destroyed, ensure we are destroyed

147 -

this.$parent.$once('hook:destroyed', this.$destroy)

142 +

// Self destruct handler

143 +

const handleDestroy = () => {

144 +

this.$nextTick(() => {

145 +

// In a `requestAF()` to release control back to application

146 +

requestAF(() => {

147 +

this.$destroy()

148 +

})

149 +

})

150 +

}

151 +

// Self destruct if parent destroyed

152 +

this.$parent.$once('hook:destroyed', handleDestroy)

153 +

// Self destruct after hidden

154 +

this.$once('hidden', handleDestroy)

148 155

},

149 156

beforeMount() {

150 157

// Ensure that the attachment position is correct before mounting

Original file line number Diff line number Diff line change

@@ -21,6 +21,7 @@ import {

21 21

isElement,

22 22

isVisible,

23 23

removeAttr,

24 +

requestAF,

24 25

select,

25 26

setAttr

26 27

} from '../../../utils/dom'

@@ -228,7 +229,14 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({

228 229 229 230

// Destroy ourselves when the parent is destroyed

230 231

if (this.$parent) {

231 -

this.$parent.$once('hook:beforeDestroy', this.$destroy)

232 +

this.$parent.$once('hook:beforeDestroy', () => {

233 +

this.$nextTick(() => {

234 +

// In a `requestAF()` to release control back to application

235 +

requestAF(() => {

236 +

this.$destroy()

237 +

})

238 +

})

239 +

})

232 240

}

233 241 234 242

this.$nextTick(() => {

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4