I have an app using Vite 5 and Vue 3 with a permission system with a handful of different decentralized modules that use js symbols to define their actions and then get registered with a centralized permission service. Using symbols allows us to not worry about naming collisions and potentially checking the wrong permission module. This works great EXCEPT FOR HMR.
So when you're editing an SFC like below and HMR fires it appears to reimport and remake those symbols, meaning they no longer match the ones in memory, so everything fails the permission checks. I totally get why that happens, but I'm hoping there's a work-around other than don't use symbols.
psuedocode, don't mind typos
<script setup lang="ts">
import { actions } from '@/permissions/crudActions';
import permissions from '@/permissions/service';
const item = someItemGeneratingThing();
</script>
<template>
<button v-if="permissions.can(actions.DELETE, item)">Delete Item</button>
<button v-if="permissions.can(actions.EDIT, item)">Save Item</button>
</template>
Anybody have any ideas on how to keep HMR, or maybe switch to auto reload for this situation, or anything better than wait for it to happen and then manually refresh the browser?