https://github.com/rktjmp/phx-necromancy
https://github.com/rktjmp/phx-necromancy
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rktjmp/phx-necromancy
- Owner: rktjmp
- Created: 2022-11-11T09:45:27.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-14T04:50:11.000Z (almost 3 years ago)
- Last Synced: 2025-01-27T08:24:53.227Z (9 months ago)
- Language: Elixir
- Size: 47.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Just sharing this code as a short example attached to the forum, not indicitive of best practices but maybe useful as a starting point.
The following readme was written to myself and is not prescriptive, instructive or well considered.
# Necromancy
Using Phoenix.LiveView inplace of classical controllers, optionally
resurrecting them from the dead.## Reasoning
- A consistent developer experience.
All your views are constructed in the same manner, with a mount, handle_params,
etc process flow. The "template render flow" is the same.- But not all views really need to be "live"
Some static [sic] pages have no sever state to update. These could/can just be
regular Phoenix controller actions.- But, but some views might warrant starting dead and then *becoming* live.
## Reasons against
- Kinda weird
- Added complexity with expecting a liveview to never connect?
- Phoenix 1.7 *may* unify how templates are put together with the new
templating engine?## Direct usecase
All pages show content, with a "live chat/form" pop-out. The live-chat should
integrate with the current page - it should not redirect.## Methods
- Show button, on click spawn iframe with liveview in it, let this do the fancy
work.
- Simpler, no hacks
- iframes ugly?- Dead to live
- render view as dead-liveview, on click connect livesocket or import livesocket code