jdmarshall
What's the best way to introduce components that generate their own urls?
I was trying to introduce a live component to more uniformly display a data structure that appears broadly across my app, including interactions, and I bumped into a hitch.
I wanted to have a default behavior for a link in the widget, and I discovered in trying to do so that core_components can’t use the ~p sigil. And the threads I could find for fixing it have advice that’s more appropriate for a custom component not in core_components.
I can just pull this component out to its own file and just load the html helpers there, so if that were the end of the story I would just ‘un-ask the question’ and move on. But working on this component has gotten me thinking about other components I might try to make that could be worth a PR, such as a more intelligent back button component (eg for …/show/… routes, which are currently kind of a pain in the butt)
What would be the right way to introduce a core component that did its own patch or navigate arithmetic?
Marked As Solved
sodapopcan
You just need to do:
use MyAppWeb, :verified_routes
in any modules you want to use ~p in.
Also Liked
jdmarshall
It works. Thanks!
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









