Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with LV v0.20 #725

Merged
merged 7 commits into from
Feb 7, 2024
Merged

Compatibility with LV v0.20 #725

merged 7 commits into from
Feb 7, 2024

Conversation

msaraiva
Copy link
Member

@msaraiva msaraiva commented Jan 3, 2024

  • Fix Malformed HTML in rendered.js
  • Fix error when passing special chars as literals inside an expression

@msaraiva msaraiva self-assigned this Jan 3, 2024
@dougw-bc
Copy link

dougw-bc commented Jan 4, 2024

I have run into some other issues that are not fixed with this branch related to LiveComponents, I made a comment about it here: #713

@dougw-bc
Copy link

Ignore my previous comment, this branch is OK on liveview 0.20.3

Users do need to be careful, and make sure all LiveComponent's use static html at the root - but it is an easy enough change.

For example:

In previous versions the following works OK, (but maybe poorly optimized?):
defmodule StaticComponent do
 @moduledoc "Static component used by a livecomponent"
 use Surface.Component 
 
 slot default
 
 def render(assigns) do
  ~F"""
   <div>
    <#slot />
   </div>
  """
 end
end

defmodule ALiveComponent do
 @moduledoc "live component with static component at root"
 use Surface.LiveComponent 

 def render(assigns) do
   ~F"""
    <StaticComponent>
      <div>
        Some LiveComponent Content
      </div>
    </StaticComponent>
   """
 end
end

defmodule ALiveView do
 @moduledoc "LiveView that renders the livecomponent"
 use Surface.LiveView

 def render(assigns) do
   ~F"""
    <ALiveComponent id="a_live_component" />
   """
 end
end
This PR requires the following change to the above example live component (additional wrapping static node):
defmodule ALiveComponent do
  @moduledoc "additional static html node at root of live component"
  use Surface.LiveComponent 

  def render(assigns) do
    ~F"""
     <div>
      <StaticComponent>
        <div>
          Some LiveComponent Content
        </div>
      </StaticComponent>
     </div> 
    """
  end
end

@msaraiva msaraiva merged commit 65729d4 into main Feb 7, 2024
6 checks passed
@msaraiva msaraiva deleted the fix-lv-20-compat branch February 7, 2024 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants