Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Config options in router not honoured #544

Closed
Lissy93 opened this issue Mar 8, 2022 Discussed in #542 · 10 comments
Closed

[BUG] Config options in router not honoured #544

Lissy93 opened this issue Mar 8, 2022 Discussed in #542 · 10 comments
Assignees
Labels
🐛 Bug [ISSUE] Ticket describing something that isn't working

Comments

@Lissy93
Copy link
Owner

Lissy93 commented Mar 8, 2022

Discussed in #542

Originally posted by lephtHanded March 8, 2022
heya!
latest update (or my config) seems borked with the latest docker pull.
the routingMode and startingView options don't seem to have an effect.

i have mine set to hash and minimal respectively and the page loads to the default view.

links to ../minimal or ../#/minimal that I got working from this thread just open the default view now.

Probable Cause

The config isn't finished fetching when the router is initialised

@Lissy93 Lissy93 self-assigned this Mar 8, 2022
@Lissy93 Lissy93 added the 🐛 Bug [ISSUE] Ticket describing something that isn't working label Mar 8, 2022
@azerioxal
Copy link
Contributor

I've been working on this for a long time now. startingView is a fairly simple fix, but I have not been having any luck in figuring out how to get routingMode to work.

Vue router only accepts the mode option being passed at initialization and it can't be changed at runtime. Since the config is now fetched this leads to the issue.

Do you have any ideas on a way to sort this out?

@liss-bot liss-bot added the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label Mar 9, 2022
@Lissy93
Copy link
Owner Author

Lissy93 commented Mar 9, 2022

I guess the only option would be to use an environmental variable,
const mode = process.env.VUE_APP_ROUTING_MODE || 'history';

I was also thinking, since routing mode is unlikely to be something the user changes frequently it could be read statically at build time, but this doesn't seem very neat

@liss-bot liss-bot removed the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label Mar 9, 2022
@azerioxal
Copy link
Contributor

azerioxal commented Mar 9, 2022

The environment variable would work for reading at build time. Though, that would mean adding the build step back into the docker image. Which I guess isn't too bad as it would only have run on first start and change to that variable, but it would mean removing the ability to drop the size of the image by removing all the vue dependencies.

@liss-bot liss-bot added the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label Mar 9, 2022
@Lissy93
Copy link
Owner Author

Lissy93 commented Mar 9, 2022

Ahh it's a tricky one. but I think for now, moving src/ back into the container is the only way to fix this

@liss-bot liss-bot removed the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label Mar 9, 2022
@azerioxal
Copy link
Contributor

azerioxal commented Mar 10, 2022

I've actually come up with a solution that works! We can add a script tag to the top of index.html that initializes before the Vue app and loads any variables needed before it, like routingMode.

This file can even be generated from conf.yml by the server. Those using a static host would have to edit the additional file if they want to change routingMode, but like you mentioned earlier, it's not something that will be changed often, if at all after the original setting.

This will allow us to keep shrinking the docker image, and not have to delay startup with a build. What're your thoughts?

@liss-bot liss-bot added the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label Mar 10, 2022
@Lissy93
Copy link
Owner Author

Lissy93 commented Mar 10, 2022

Would that work? I think the Vue router stuff is compiled at build time- I might be wrong, but playing around with it that seemed to be the case. If it works, then that's awesome

@liss-bot liss-bot removed the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label Mar 10, 2022
@azerioxal
Copy link
Contributor

It works in my testing. I think it feels like the router options are done at build time because of how they're loaded as soon as the Vue app starts up with main.js.

I'll submit it shortly for you to look at.

@liss-bot liss-bot added the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label Mar 11, 2022
@Lissy93 Lissy93 linked a pull request Mar 11, 2022 that will close this issue
3 tasks
@lephtHanded
Copy link

you guys fixt it!
thank you!

Repository owner deleted a comment from liss-bot Mar 15, 2022
@Lissy93
Copy link
Owner Author

Lissy93 commented Mar 15, 2022

Yay, nice one @ateroz! Glad it's working again now :)

@Lissy93 Lissy93 closed this as completed Mar 15, 2022
@Lissy93
Copy link
Owner Author

Lissy93 commented Mar 15, 2022

Yay, nice one @ateroz! Glad it's working again now :)

@liss-bot liss-bot removed the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug [ISSUE] Ticket describing something that isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants