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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="stefanchrobot" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/stefanchrobot/120/7657_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  stefanchrobot
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think you could clean up your <code>.sface</code> file by splitting it into “logged-in” and “logged-out” parts. Something like:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">{#if @auth == :logged_in}
  {!-- ... --}
{#else}
  {!-- ... --}
{/if}
</code></pre>
<p>You could also push the decision not to render anything down to the components, e.g. do the <code>:if={@auth ...</code> inside of the component.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="228857" 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/surface-a-component-based-library-for-phoenix-liveview/27671/194">Post #193</a>
	                </div>
	            </div>
              <div id="likers-container-228857" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="228857"
                     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 #193"></div>
  </section>
</div>
    <div class="postbit" id="228859" data-post-id="228859">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="derek-zhou" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/derek-zhou/120/19943_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  derek-zhou
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I’ve tried that. However, it somehow sends a larger delta down the wire than what I had in mind in certain cases. Per component <code>:if</code> clause works better, if a little verbose.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="228859" 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/surface-a-component-based-library-for-phoenix-liveview/27671/195">Post #194</a>
	                </div>
	            </div>
              <div id="likers-container-228859" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="228859"
                     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 #194"></div>
  </section>
</div>
    <div class="postbit" id="228977" data-post-id="228977">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="wdiechmann" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/wdiechmann/120/5725_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  wdiechmann
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Allow me to try to rephrase my questions regarding Surface:</p>
<p>(1) Organizing source code</p>
<p>If I have a <code>&lt;div&gt;</code> that will receive a lot of different content, like <code>&lt;EditableDocument&gt;</code> and <code>&lt;ListOfUsers&gt;</code> and <code>&lt;OrganizationMap&gt;</code> what are my options - if any?</p>
<p>From <a class="mention" href="/u/derek-zhou" rel="nofollow">@derek-zhou</a> I’ve learned that one way is using conditions and remembering to naming all possible outcomes and keeping the <code>handle_params</code> to go with it in one file – which to me looks like 1 router.ex, 1 ‘controller’.ex, 1 ‘.sface’, and a whole pile of logic modules behind this, dealing with persistence and data structures and business logic.</p>
<p>Is that the way FP will like it served? Or can it be broken up somehow - looking at 15/20 different “view objects” (ehh can I say object in here at all <img src="https://forum.elixirforum.com/images/emoji/apple/sweat_smile.png?v=15" title=":sweat_smile:" class="emoji" alt=":sweat_smile:" loading="lazy" width="20" height="20"> ) like the ones above, I’m trying to find a way to keep things apart.</p>
<p>(2) (Side) effects</p>
<p>If I have a <code>&lt;button&gt;</code> or <code>&lt;a&gt;</code> that should change the content of a number of <code>&lt;div&gt;</code>s around the screen how can I “LivePatch” in more than one place from that click-event?</p>
<hr>
<p>I sincerely apologize for my questions just simply being sheer bullocks and me presenting my utter n00b-ness; then please call it and, if I may trouble you, please point me to some documentation/code samples setting me straight <img src="https://forum.elixirforum.com/images/emoji/apple/heart.png?v=15" title=":heart:" class="emoji" alt=":heart:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="228977" 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/surface-a-component-based-library-for-phoenix-liveview/27671/196">Post #195</a>
	                </div>
	            </div>
              <div id="likers-container-228977" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="228977"
                     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 #195"></div>
  </section>
</div>
    <div class="postbit" id="229104" data-post-id="229104">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cmo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cmo/120/19618_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cmo
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>You can create different layout components and use them as per <a href="https://forum.elixirforum.com/t/surface-a-component-based-library-for-phoenix-liveview/27671/122" rel="nofollow">this post</a>. That’s what I’ve started doing. If you have a layout which has several sections, you can create slots for them.</p>
<p>I don’t understand what you mean by “a div receives components”. If that div shows different content depending on the route, use live actions and a <code>case @live_action do</code>.</p>
<p>The idea of putting it all in one LiveView would be insane in my project. It depends on your app. If it’s really simple and has a single layout, then sure. I think in the early phase it’s easiest to be verbose, repeat yourself and create individual views. Then it will become clear what to componentise.</p>
<p>The code you have there is not big.  Don’t try to do it perfectly. Make a mess and learn by tidying up.</p>
<p>For 2), The divs that you want to change must accept an <code>assign</code> that is changed by the event that is triggered by the button/link. User input triggers events, events change assigns, assigns change UI. If it is navigating to another route, you patch/redirect and let the mount/params/live_action drive the changes to the UI.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="229104" 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/surface-a-component-based-library-for-phoenix-liveview/27671/197">Post #196</a>
	                </div>
	            </div>
              <div id="likers-container-229104" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="229104"
                     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 #196"></div>
  </section>
</div>
    <div class="postbit" id="229107" data-post-id="229107">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="wdiechmann" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/wdiechmann/120/5725_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  wdiechmann
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>My thoughts must have drifted off (did believe to have sifted through this entire thread) thx for the link!</p>
<p>Pertaining to the <code>&lt;div&gt;</code> – first I tried with a small piece of graphics <a href="https://forum.elixirforum.com/t/surface-a-component-based-library-for-phoenix-liveview/27671/192" rel="nofollow">here</a> but that didn’t generate much feedback so I guess I’d try with a verbal description.</p>
<p>thx a lot for sharing <a class="mention" href="/u/cmo" rel="nofollow">@cmo</a> !</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="229107" 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/surface-a-component-based-library-for-phoenix-liveview/27671/198">Post #197</a>
	                </div>
	            </div>
              <div id="likers-container-229107" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="229107"
                     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 #197"></div>
  </section>
</div>
    <div class="postbit" id="233384" data-post-id="233384">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Nefcairon" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Nefcairon/120/31921_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Nefcairon
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I wanted to use <code>handle_info</code> in a Surface.LiveComponent. Is there a reason why this is not supported but <code>handle_event</code> is?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233384" 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/surface-a-component-based-library-for-phoenix-liveview/27671/199">Post #198</a>
	                </div>
	            </div>
              <div id="likers-container-233384" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233384"
                     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 #198"></div>
  </section>
</div>
    <div class="postbit" id="233385" data-post-id="233385">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="olivermt" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/olivermt/120/2354_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  olivermt
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Because handle_info is for process level messages and a live component (also in plain LV, not Surface) is not a separate process. Live components live in their parent LV process.</p>
<p>So you cannot do a pubsub from a component for example.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233385" data-batch-url="/posts/batch_likers">
                        3
                      </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/surface-a-component-based-library-for-phoenix-liveview/27671/200">Post #199</a>
	                </div>
	            </div>
              <div id="likers-container-233385" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233385"
                     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 #199"></div>
  </section>
</div>
    <div class="postbit" id="233386" data-post-id="233386">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Nefcairon" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Nefcairon/120/31921_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Nefcairon
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Ok, thanks…</p>
<p>How can I then change a prop from a Surface.LiveComponent of a Surface.LiveComponent every 5 seconds?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233386" 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/surface-a-component-based-library-for-phoenix-liveview/27671/201">Post #200</a>
	                </div>
	            </div>
              <div id="likers-container-233386" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233386"
                     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 #200"></div>
  </section>
</div>
    <div class="postbit" id="233391" data-post-id="233391">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cmo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cmo/120/19618_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cmo
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Its parent LiveView can tell it to do so.  Or a component can do so with <code>send_update</code> or <code>send_update_after</code>.</p>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://phoenix-live-view.hexdocs.pm/Phoenix.LiveView.html">
  <header class="source">

      <a href="https://phoenix-live-view.hexdocs.pm/Phoenix.LiveView.html" target="_blank" rel="noopener nofollow ugc">phoenix-live-view.hexdocs.pm</a>
  </header>

  <article class="onebox-body">
    

<h3><a href="https://phoenix-live-view.hexdocs.pm/Phoenix.LiveView.html" target="_blank" rel="noopener nofollow ugc">Phoenix.LiveView — Phoenix LiveView v1.2.5</a></h3>



  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>
 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233391" 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/surface-a-component-based-library-for-phoenix-liveview/27671/202">Post #201</a>
	                </div>
	            </div>
              <div id="likers-container-233391" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233391"
                     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 #201"></div>
  </section>
</div>
    <div class="postbit" id="233406" data-post-id="233406">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Nefcairon" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Nefcairon/120/31921_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Nefcairon
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Ok, that’s clear. But how to I change my Surface Components props from the parent LiveView? They should be in the socket.assigns, shouldn’t they?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233406" 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/surface-a-component-based-library-for-phoenix-liveview/27671/203">Post #202</a>
	                </div>
	            </div>
              <div id="likers-container-233406" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233406"
                     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 #202"></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/27671/load_more?page=21">Load more posts (14 remaining)</a>
</div></template></turbo-stream>