forked from profectus/Profectus
Better handling of provide failing
Was having trouble with Vite HMR
This commit is contained in:
parent
9b89552f1c
commit
863c70222b
2 changed files with 7 additions and 6 deletions
|
@ -9,8 +9,10 @@ import { computed, inject, onUnmounted, ref, toRefs, unref, watch } from "vue";
|
||||||
const _props = defineProps<{ id: string }>();
|
const _props = defineProps<{ id: string }>();
|
||||||
const props = toRefs(_props);
|
const props = toRefs(_props);
|
||||||
|
|
||||||
const register = inject(RegisterNodeInjectionKey);
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||||
const unregister = inject(UnregisterNodeInjectionKey);
|
const register = inject(RegisterNodeInjectionKey, () => {});
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||||
|
const unregister = inject(UnregisterNodeInjectionKey, () => {});
|
||||||
|
|
||||||
const node = ref<HTMLElement | null>(null);
|
const node = ref<HTMLElement | null>(null);
|
||||||
const parentNode = computed(() => node.value && node.value.parentElement);
|
const parentNode = computed(() => node.value && node.value.parentElement);
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Link } from "features/links/links";
|
import type { Link } from "features/links/links";
|
||||||
|
import type { FeatureNode } from "game/layers";
|
||||||
import { BoundsInjectionKey, NodesInjectionKey } from "game/layers";
|
import { BoundsInjectionKey, NodesInjectionKey } from "game/layers";
|
||||||
import { computed, inject, ref, toRef, watch } from "vue";
|
import { computed, inject, ref, toRef, watch } from "vue";
|
||||||
import LinkVue from "./Link.vue";
|
import LinkVue from "./Link.vue";
|
||||||
|
@ -23,10 +24,8 @@ const links = toRef(_props, "links");
|
||||||
|
|
||||||
const resizeListener = ref<Element | null>(null);
|
const resizeListener = ref<Element | null>(null);
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
const nodes = inject(NodesInjectionKey, ref<Record<string, FeatureNode | undefined>>({}));
|
||||||
const nodes = inject(NodesInjectionKey)!;
|
const outerBoundingRect = inject(BoundsInjectionKey, ref<DOMRect | undefined>(undefined));
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
||||||
const outerBoundingRect = inject(BoundsInjectionKey)!;
|
|
||||||
const boundingRect = ref<DOMRect | undefined>(undefined);
|
const boundingRect = ref<DOMRect | undefined>(undefined);
|
||||||
watch(
|
watch(
|
||||||
[outerBoundingRect],
|
[outerBoundingRect],
|
||||||
|
|
Loading…
Reference in a new issue