<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="174212" data-post-id="174212">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="benwilson512" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/benwilson512/120/1457_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  benwilson512
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Author of Craft GraphQL APIs in Elixir with Absinthe</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="cnck1387" data-post="10" data-topic="30751">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/c/2bfe46/48.png" class="avatar"> cnck1387:</div>
<blockquote>
<p>Typically partials are in the templates directory.</p>
</blockquote>
</aside>
<p>Notably, I’ve largely ditched the traditional view structure used by Phoenix controllers / views / templates in favor of:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">my_app_web/
  pages/
    shipments/
      show/
        show.html.leex # the template
        show.ex # the live view
        data.ex # a data fetching helper
        view_helper.ex # the normal phoenix view helper
        components/ # components relevant only to this page
          ...
</code></pre>
<p>It makes this whole process way easier. I don’t really like <code>Live</code> in the module name anyway, it holds not a lot of value. The shipment show module name would be <code>MyAppWeb.Pages.Shipments.Show</code>, so it gets named just like any other Elixir module. All the files for a page are all in one nice spot, and you can make a new page by just copying and pasting any existing page folder.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="174212" data-batch-url="/posts/batch_likers">
                        7
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/concrete-examples-of-when-to-use-live-patch-live-redirect-push-redirect-push-patch/30751/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-174212" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="174212"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="174213" data-post-id="174213">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sasajuric" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sasajuric/120/991_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sasajuric
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Author of Elixir In Action</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="benwilson512" data-post="12" data-topic="30751">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/benwilson512/48/1457_2.png" class="avatar"> benwilson512:</div>
<blockquote>
<p>It makes this whole process way easier. I don’t really like <code>Live</code> in the module name anyway, it holds not a lot of value.</p>
</blockquote>
</aside>
<p>I only played briefly with live view, once about a year ago, and once in the past weekend, and I pretty much went for a similar structure, with the only difference being that I didn’t use <code>Pages</code>. This weekend, while experimenting, I used the name <code>Controller</code> for the live view module. So I ended up with something like <code>MySystemWeb.PageA.Controller</code>, <code>MySystemWeb.PageB.Controller</code>, etc.</p>
<p>I find it much saner to navigate through the code, and as you say the things which are frequently read or changed together are in the same place. I also think that the word <code>Live</code> is basically noise. Whether something is a live view or not is imo an implementation detail, and doesn’t belong to the module name.</p>
<p>In the future I plan to do the same thing with controllers. I already did something similar for my blog, but that’s a very simple case so I ended up consolidating everything behind a single controller.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="174213" data-batch-url="/posts/batch_likers">
                        5
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/concrete-examples-of-when-to-use-live-patch-live-redirect-push-redirect-push-patch/30751/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-174213" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="174213"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="174219" data-post-id="174219">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cnck1387" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cnck1387
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="11" data-topic="30751">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>So you can’t patch across different LiveViews. If the client emits a patch but it is another LiveView, it falls back to a redirect.</p>
</blockquote>
</aside>
<p>Ah, so then typically unless you have very specific requirements (like wanting iframes in your page to not be manipulated) you would <code>live_redirect</code> between all things that would normally be seen as “controllers” in a regular app. Like going from a blog index page to a contact page, or even something like going from listing commits to listing branches in GitHub’s UI as an example (tabs when looking at a repo)?</p>
<p>But wouldn’t this also mean some benefits that Chris talks about in his keynote of live view are not really benefits? For example, he talks about not having to look a user up on every page transition like you normally would with a controller plug.</p>
<p>Wouldn’t you end up looking up and assigning a <code>current_user</code> in the mount function of each LV, which would then get executed and looked up from the DB on every <code>live_redirect</code>? Basically in this case this assigns is comparable to a plug that sets a current_user.</p>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="11" data-topic="30751">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>They have to be in the templates directory, since the partial belongs to a View (and not the LiveView). I will clarify this.</p>
</blockquote>
</aside>
<p>If you were breaking apart a template to make it more readable would you pick render or a stateless component as a best practice?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="174219" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/concrete-examples-of-when-to-use-live-patch-live-redirect-push-redirect-push-patch/30751/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-174219" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="174219"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="174220" data-post-id="174220">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cnck1387" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cnck1387
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>What type of modifications did you have to make in your app’s various Phoenix config files for it to look for controllers, templates, views and other things in that directory?</p>
<p>Also have you talked to any of the core team members on maybe recommending this style as the default, or as what the generators generate?</p>
<p>I think one cool thing about Rails is 95% of the apps you see feel the same at a structural level. You can get pretty productive in any code base just by knowing Rails. This also helps you in the long run because after 3 months of not touching a code base, you know where to go.</p>
<p>Are you concerned that if you go way off the beaten path and drastically change how you organize your Phoenix project, then it’ll make it difficult for others to work with your code base? Especially so if out of 100 developers, we end up with 30 different styles of file organization strategies.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="174220" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/concrete-examples-of-when-to-use-live-patch-live-redirect-push-redirect-push-patch/30751/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-174220" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="174220"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="174221" data-post-id="174221">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="benwilson512" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/benwilson512/120/1457_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  benwilson512
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Author of Craft GraphQL APIs in Elixir with Absinthe</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Likely one of the issues here is [quote=“cnck1387, post:15, topic:30751”]<br>
What type of modifications did you have to make in your app’s various Phoenix config files for it to look for controllers, templates, views and other things in that directory?<br>
[/quote]</p>
<p>All I had to do was:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># in MyAppWeb
  def page_view do
    quote do
      use Phoenix.View,
        root: "#{__DIR__}/templates/",
        path: "",
        namespace: ControlTowerWeb
  ... # other stuff that is copied from `def view`
</code></pre>
<p>Which reminds me that I actually put the templates in a <code>templates</code> directory within that page.</p>
<p>Then in the <code>view_helper.ex</code> file you <code>use MyAppWeb, :page_view</code>.</p>
<aside class="quote no-group" data-username="cnck1387" data-post="15" data-topic="30751">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/c/2bfe46/48.png" class="avatar"> cnck1387:</div>
<blockquote>
<p>Also have you talked to any of the core team members on maybe recommending this style as the default, or as what the generators generate?</p>
</blockquote>
</aside>
<p>Not yet.</p>
<aside class="quote no-group" data-username="cnck1387" data-post="15" data-topic="30751">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/c/2bfe46/48.png" class="avatar"> cnck1387:</div>
<blockquote>
<p>I think one cool thing about Rails is 95% of the apps you see feel the same at a structural level. You can get pretty productive in any code base just by knowing Rails.</p>
</blockquote>
</aside>
<p>Sort of. Rails works great when you have &lt; 50 controllers, models, etc. As you grow to more than that it becomes extremely unwieldy. This is part of what I like about Phoenix’s use of contexts. It creates some organization within the data side of the application.</p>
<p>This is an effort to do the same thing on the UI side.</p>
<aside class="quote no-group" data-username="cnck1387" data-post="15" data-topic="30751">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/c/2bfe46/48.png" class="avatar"> cnck1387:</div>
<blockquote>
<p>Are you concerned that if you go way off the beaten path and drastically change how you organize your Phoenix project, then it’ll make it difficult for others to work with your code base?</p>
</blockquote>
</aside>
<p>Not at all. “All the stuff for the page is here” has been super easy for people to get used to. We’ve got folks who are familiar with Elixir, and folks who are just starting having come from Rails / React and everybody seems to find it pretty straight forward.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="174221" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/concrete-examples-of-when-to-use-live-patch-live-redirect-push-redirect-push-patch/30751/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-174221" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="174221"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="174231" data-post-id="174231">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cnck1387" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cnck1387
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Where would your controller go with that structure, and how would that pan out when you would usually have 1 controller with a show action + other actions in 1 file?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="174231" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/concrete-examples-of-when-to-use-live-patch-live-redirect-push-redirect-push-patch/30751/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-174231" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="174231"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="174234" data-post-id="174234">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="cnck1387" data-post="14" data-topic="30751">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/c/2bfe46/48.png" class="avatar"> cnck1387:</div>
<blockquote>
<p>But wouldn’t this also mean some benefits that Chris talks about in his keynote of live view are not really benefits? For example, he talks about not having to look a user up on every page transition like you normally would with a controller plug.</p>
</blockquote>
</aside>
<p>It depends on what you consider to be transitions. For example, in a regular app, whenever you paginate, re-order a table, search results, etc, you have to fetch the current user, current organization and what not. With LV now you can use phx-click or live_patch for those, and those won’t do the refetching.</p>
<p>In my app I even have a settings page with different tabs, each tab is a component within the same LV, so navigating between those won’t reload either. So the benefit is definitely there for a lot of your interactions and transitions.</p>
<aside class="quote no-group" data-username="cnck1387" data-post="14" data-topic="30751">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/c/2bfe46/48.png" class="avatar"> cnck1387:</div>
<blockquote>
<p>Wouldn’t you end up looking up and assigning a <code>current_user</code> in the mount function of each LV, which would then get executed and looked up from the DB on every <code>live_redirect</code> ?</p>
</blockquote>
</aside>
<p>Yes, we have a helper called <code>assign_defaults</code> that we basically call on all LV. The docs on master (not yet published) have an example of this.</p>
<aside class="quote no-group" data-username="cnck1387" data-post="14" data-topic="30751">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/c/2bfe46/48.png" class="avatar"> cnck1387:</div>
<blockquote>
<p>If you were breaking apart a template to make it more readable would you pick render or a stateless component as a best practice?</p>
</blockquote>
</aside>
<p>I would go with a component because if I want to make it stateful in the future, I am already halfway there.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="174234" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/concrete-examples-of-when-to-use-live-patch-live-redirect-push-redirect-push-patch/30751/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-174234" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="174234"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="174236" data-post-id="174236">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cnck1387" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cnck1387
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="18" data-topic="30751">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>In my app I even have a settings page with different tabs, each tab is a component within the same LV, so navigating between those won’t reload either. So the benefit is definitely there for a lot of your interactions and transitions.</p>
</blockquote>
</aside>
<p>What made you choose to use patch there instead of redirect?</p>
<p>If you were building an elaborate settings page with a number of sections, you’d probably end up having separate controllers for this in a non-LV app right? Think something like Twitter’s settings where you have account, privacy, notifications, accessibility, etc. settings.</p>
<p>Would you mind gisting your settings LV and how all of the components interact together in a way where your single settings LV doesn’t end up being a massive file with handle params and events for many many different things?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="174236" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/concrete-examples-of-when-to-use-live-patch-live-redirect-push-redirect-push-patch/30751/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-174236" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="174236"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #18"></div>
  </section>
</div>
    <div class="postbit" id="174237" data-post-id="174237">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="cnck1387" data-post="19" data-topic="30751">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/c/2bfe46/48.png" class="avatar"> cnck1387:</div>
<blockquote>
<p>What made you choose to use patch there instead of redirect?</p>
</blockquote>
</aside>
<p>To be very honest, it was a happy accident. We started with a single page, then it got complex on the code wise, so we broke them into components, and then it was complex on the UI, so we broke them into tabs (pretty similar to Twitter’s).</p>
<p>All of our LiveViews follow the Phoenix convention, this one is something like this:</p>
<pre><code>live/
  user_settings/
    index.ex
    index.html.leex
    change_email_component.ex
    change_password_component.ex
    totp_component.ex
    ...
</code></pre>
<p>We are doing collocated templates for LiveViews and embedded templates for components.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="174237" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/concrete-examples-of-when-to-use-live-patch-live-redirect-push-redirect-push-patch/30751/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-174237" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="174237"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #19"></div>
  </section>
</div>
    <div class="postbit" id="174250" data-post-id="174250">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cnck1387" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cnck1387
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks. Would you mind gisting what some of those files look like and how it’s pieced together?</p>
<p>My biggest struggle with LV is how to avoid having a single LV get massive in size, since I have to use patch to avoid some iframe related issues, I couldn’t figure out a way to stuff multiple tabs worth of content (each having their own CRUD interface) into a single LV and have it maintainable in the end.</p>
<p>In addition to that, I ended up with weirdly named route actions like <code>foo_index</code>, <code>foo_show</code> where “foo” is a CRUD’able resource, and they all belonged to the same LV.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="174250" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/concrete-examples-of-when-to-use-live-patch-live-redirect-push-redirect-push-patch/30751/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-174250" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="174250"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #20"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/30751/load_more?page=3">Load more posts (4 remaining)</a>
</div></template></turbo-stream>