Skip to content

Commit

Permalink
fix: infinite render issue in radar and do some code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lallenfrancisl committed Dec 27, 2023
1 parent ffac312 commit 9c63a97
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
15 changes: 11 additions & 4 deletions src/components/Radar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@
top: coord.y,
}"
class="absolute -translate-x-1/2 -translate-y-1/2"
:name="useId()"
:name="coord.id"
/>
</div>
</template>
Expand All @@ -455,6 +455,11 @@ interface AvatarCoord {
* y coord as `npx`
*/
y: string;
/**
* Id for the coord
*/
id: string;
}
const coords = ref<AvatarCoord[]>([]);
Expand All @@ -471,11 +476,13 @@ function getAllAvatarCoords(el: HTMLElement) {
for (const point of points.values()) {
const { x, y } = point.getBoundingClientRect();
coords.push({ x: `${Math.round(x)}px`, y: `${Math.round(y)}px` });
coords.push({
x: `${Math.round(x)}px`,
y: `${Math.round(y)}px`,
id: useId(),
});
}
console.log("coordinates: ", coords);
// return coords;
return coords.filter((__, index) => {
Expand Down
1 change: 0 additions & 1 deletion src/pages/ListSpacesPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ function closeCreateSpaceModal() {
const router = useRouter();
function createSpace(name: string) {
console.log("space: ", name);
router.push({ name: "space", params: { name: name } });
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/SpacePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</div>

<div class="flex justify-center">
<FilePicker @select="console.log($event)">
<FilePicker>
<AppButton label="add file" variant="rounded">
<PlusIcon class="h-8 w-auto" />
</AppButton>
Expand Down

0 comments on commit 9c63a97

Please sign in to comment.