1
0
Fork 0
mirror of synced 2024-10-04 03:54:37 +13:00

Minor fixes for reactivity issues and some updates

This commit is contained in:
Dean 2023-01-23 09:06:21 +00:00
parent f53542c45b
commit a9ce6e9cc0
4 changed files with 24 additions and 5 deletions

View file

@ -3,6 +3,9 @@ export default function positionDropdown(
{ anchor, align, maxWidth, useAnchorWidth, showTip }
) {
const update = () => {
if (!anchor) {
return
}
const anchorBounds = anchor.getBoundingClientRect()
const elementBounds = element.getBoundingClientRect()
let styles = {
@ -66,7 +69,9 @@ export default function positionDropdown(
const resizeObserver = new ResizeObserver(entries => {
entries.forEach(update)
})
resizeObserver.observe(anchor)
if (anchor) {
resizeObserver.observe(anchor)
}
resizeObserver.observe(element)
resizeObserver.observe(document.body)

View file

@ -16,6 +16,9 @@
$: tourStepKey = $store.tourStepKey
const initTour = targetKey => {
if (!targetKey) {
return
}
tourSteps = [...TOURS[targetKey]]
tourStepIdx = 0
tourStep = { ...tourSteps[tourStepIdx] }
@ -24,6 +27,9 @@
$: initTour(tourKey)
const updateTourStep = targetStepKey => {
if (!tourSteps?.length) {
return
}
tourStepIdx = getCurrentStepIdx(tourSteps, targetStepKey)
lastStep = tourStepIdx + 1 == tourSteps.length
tourStep = { ...tourSteps[tourStepIdx] }
@ -33,6 +39,9 @@
$: updateTourStep(tourStepKey)
const showPopover = (tourStep, tourNodes, popover) => {
if (!tourStep) {
return
}
popoverAnchor = tourNodes[tourStep.id]
popover?.show()
}

View file

@ -20,7 +20,9 @@
ready = true
})
onDestroy(() => {
handler.destroy()
if (handler) {
handler.destroy()
}
})
</script>

View file

@ -72,11 +72,14 @@ const getTours = () => {
onboardedAt: new Date().toISOString(),
})
// Update the cached user
await auth.getSelf()
store.update(state => ({
...state,
tourNodes: null,
tourKey: null,
tourKeyStep: null,
tourNodes: undefined,
tourKey: undefined,
tourKeyStep: undefined,
onboarding: false,
}))
}