Minor fixes for reactivity issues and some updates
This commit is contained in:
parent
f53542c45b
commit
a9ce6e9cc0
|
@ -3,6 +3,9 @@ export default function positionDropdown(
|
||||||
{ anchor, align, maxWidth, useAnchorWidth, showTip }
|
{ anchor, align, maxWidth, useAnchorWidth, showTip }
|
||||||
) {
|
) {
|
||||||
const update = () => {
|
const update = () => {
|
||||||
|
if (!anchor) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const anchorBounds = anchor.getBoundingClientRect()
|
const anchorBounds = anchor.getBoundingClientRect()
|
||||||
const elementBounds = element.getBoundingClientRect()
|
const elementBounds = element.getBoundingClientRect()
|
||||||
let styles = {
|
let styles = {
|
||||||
|
@ -66,7 +69,9 @@ export default function positionDropdown(
|
||||||
const resizeObserver = new ResizeObserver(entries => {
|
const resizeObserver = new ResizeObserver(entries => {
|
||||||
entries.forEach(update)
|
entries.forEach(update)
|
||||||
})
|
})
|
||||||
resizeObserver.observe(anchor)
|
if (anchor) {
|
||||||
|
resizeObserver.observe(anchor)
|
||||||
|
}
|
||||||
resizeObserver.observe(element)
|
resizeObserver.observe(element)
|
||||||
resizeObserver.observe(document.body)
|
resizeObserver.observe(document.body)
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
$: tourStepKey = $store.tourStepKey
|
$: tourStepKey = $store.tourStepKey
|
||||||
|
|
||||||
const initTour = targetKey => {
|
const initTour = targetKey => {
|
||||||
|
if (!targetKey) {
|
||||||
|
return
|
||||||
|
}
|
||||||
tourSteps = [...TOURS[targetKey]]
|
tourSteps = [...TOURS[targetKey]]
|
||||||
tourStepIdx = 0
|
tourStepIdx = 0
|
||||||
tourStep = { ...tourSteps[tourStepIdx] }
|
tourStep = { ...tourSteps[tourStepIdx] }
|
||||||
|
@ -24,6 +27,9 @@
|
||||||
$: initTour(tourKey)
|
$: initTour(tourKey)
|
||||||
|
|
||||||
const updateTourStep = targetStepKey => {
|
const updateTourStep = targetStepKey => {
|
||||||
|
if (!tourSteps?.length) {
|
||||||
|
return
|
||||||
|
}
|
||||||
tourStepIdx = getCurrentStepIdx(tourSteps, targetStepKey)
|
tourStepIdx = getCurrentStepIdx(tourSteps, targetStepKey)
|
||||||
lastStep = tourStepIdx + 1 == tourSteps.length
|
lastStep = tourStepIdx + 1 == tourSteps.length
|
||||||
tourStep = { ...tourSteps[tourStepIdx] }
|
tourStep = { ...tourSteps[tourStepIdx] }
|
||||||
|
@ -33,6 +39,9 @@
|
||||||
$: updateTourStep(tourStepKey)
|
$: updateTourStep(tourStepKey)
|
||||||
|
|
||||||
const showPopover = (tourStep, tourNodes, popover) => {
|
const showPopover = (tourStep, tourNodes, popover) => {
|
||||||
|
if (!tourStep) {
|
||||||
|
return
|
||||||
|
}
|
||||||
popoverAnchor = tourNodes[tourStep.id]
|
popoverAnchor = tourNodes[tourStep.id]
|
||||||
popover?.show()
|
popover?.show()
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,9 @@
|
||||||
ready = true
|
ready = true
|
||||||
})
|
})
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
handler.destroy()
|
if (handler) {
|
||||||
|
handler.destroy()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -72,11 +72,14 @@ const getTours = () => {
|
||||||
onboardedAt: new Date().toISOString(),
|
onboardedAt: new Date().toISOString(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Update the cached user
|
||||||
|
await auth.getSelf()
|
||||||
|
|
||||||
store.update(state => ({
|
store.update(state => ({
|
||||||
...state,
|
...state,
|
||||||
tourNodes: null,
|
tourNodes: undefined,
|
||||||
tourKey: null,
|
tourKey: undefined,
|
||||||
tourKeyStep: null,
|
tourKeyStep: undefined,
|
||||||
onboarding: false,
|
onboarding: false,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue