thombruce / candyfloss

🍬
http://thombruce.github.io/candyfloss/
MIT License
0 stars 0 forks source link

App Restructuring #6

Open thombruce opened 2 years ago

thombruce commented 2 years ago

Attempted to setup project by another name: Gumdrop. Unfortunately, despite appearances, this name was already taken on Vercel. So let's consider what I'm really attempting to do...

I want to separate out what is currently just a donation app into its own SPA. This way, I can maintain the statically generated blog separately.

One way to do this worth considering is to separate the application out into an embeddable app of some description.

A part of Nuxt3 under dev is pluggable child apps: https://github.com/nuxt/rfcs/issues/30. Not sure that solves this particular problem though, as the apps likely share a config. See also: https://github.com/nuxt-contrib/nuxt-extend

Instead... we could separate the entirety of the donation application logic into a Vue component... one with its own implementation of Vue Router. Would have to see if Vue Router is even implementable at component level.

If Vue Router itself cannot be implemented at component level... well... we're stuck at our current implementation, which is the use of query parameters instead of router hash mode.

Note: That's fundamentally the desired result here. The use of hash mode to enable URLs more like /donate/#/:address?e=0.5 rather than /donate?a=:address&e=0.5. It's just a little bit cleaner.


Y'know... the simplest solution is often the best. What might work is to fundamentally create entirely separate apps which nuxt generate into separate directories in some base app folder. You lose programmatic navigation... shared state (unless cached in browser storage)... and are redundantly serving similar code from different locations...

...but it would work, and it would work easily.

I honestly think it's that or nothing, so it's worth considering.

thombruce commented 2 years ago

Note that to properly implement the proposed simple solution, we would need to ensure that whatever dist directory we do write to is not overridden by subsequent writes of other apps... which it wouldn't be if we're targeting subdirs within that directory, but to that point we also do need to ensure some content exists in the base dir - so there's the question of how we generate that.

thombruce commented 2 years ago

Should just opt for SSR actually. It solves these problems by handling page requests server side. 🤷‍♂️

SSR would be a solid foundation, easy to implement... occasionally unnecessary. But this is definitely a use case.