chore: add env var to use createWebHashHistory
#3313
No reviewers
Labels
No Label
area/internal-code
changes requested
confirmed
dependencies
duplicate
good first issue
help wanted
hosting
invalid
kind/bug
kind/feature
question
wontfix
No Milestone
No project
No Assignees
4 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vikunja/frontend#3313
Loading…
Reference in New Issue
No description provided.
Delete Branch "WofWca/frontend:router-hash-hostory-env"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is needed to deploy on servers like GitHub pages.
Hi WofWca!
Thank you for creating a PR!
I've deployed the changes of this PR on a preview environment under this URL: https://3313-router-hash-hostory-env--vikunja-frontend-preview.netlify.app
You can use this url to view the changes live and test them out.
You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/.
Have a nice day!
@ -1,4 +1,4 @@
import { createRouter, createWebHistory } from 'vue-router'
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
Do you know if vite / esbuild is intelligent enough to only bundle only one of those two history implementations imports?
Because the information should be available at build time.
If not could we check if this is possible?
So what I mean is: in case esbuild isn't intelligent enough could we help it via some 'special syntax' ala:
(pseudocode)
and then
Webpack is capable of eliminating unused imports. Not sure about others.
@ -82,3 +82,3 @@
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
history: import.meta.env.VITE_ROUTER_HISTORY_MODE_IS_HASH === 'true'
So this will be replaced on build time but will still contain the complete import.
Can you add the new envs also to
/env.d.ts
?Vikunja actually used the has history mode in the beginning. We gave up using it because it would not work with query params which are used for password resets and email confirmation links.
The other problem is these emails are sent by the api without knowledge of whether the frontend uses the hash mode or the web history mode.
Since these two problems are rather fundamental, I'm afraid we can't merge this. Sorry about that.
Actually I asked myself often if it wouldn't make sense to use new routes instead for the callbacks. The problem that the API doesn't know if the frontend is using hash mode or history mode could also be easily fixed via always using the hash mode backend and in frontend something like (copied from boot.dev):
@konrad Reopening because unsure if you saw the comment :)
@dpschen You mean to add the snippet you're proposing to this PR as well?
Yes