Skip to content

Commit

Permalink
Remove view_context
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper committed Feb 14, 2025
1 parent 8db1b4f commit db970d1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lib/phlex/sgml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ def to_proc
proc { |c| c.render(self) }
end

def call(buffer = +"", context: {}, view_context: nil, fragments: nil, &)
def call(buffer = +"", context: {}, fragments: nil, &)
state = Phlex::SGML::State.new(
user_context: context,
view_context:,
output_buffer: buffer,
fragments: fragments&.to_set,
)
Expand Down
5 changes: 2 additions & 3 deletions lib/phlex/sgml/state.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
# frozen_string_literal: true

class Phlex::SGML::State
def initialize(user_context: {}, view_context: nil, output_buffer:, fragments:)
def initialize(user_context: {}, output_buffer:, fragments:)
@buffer = +""
@capturing = false
@user_context = user_context
@fragments = fragments
@fragment_depth = 0
@cache_stack = []
@halt_signal = nil
@view_context = view_context
@output_buffer = output_buffer
end

attr_accessor :buffer, :capturing, :user_context

attr_reader :fragments, :fragment_depth, :view_context, :output_buffer
attr_reader :fragments, :fragment_depth, :output_buffer

def around_render(component)
stack = @stack
Expand Down

3 comments on commit db970d1

@eminkel
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Joel,

I'm curious why this was removed?

I'm using Lookbook 2.3.4 which passes this to the preview.html.erb (https://github.com/lookbook-hq/lookbook/blob/main/app/views/lookbook/previews/preview.html.erb) in a call method. What do I replace or modify to get similar functionality as before?

If this is the wrong spot, I can open an issue in phlex or lookbook. Any help is greatly appreciated.

@joeldrapper
Copy link
Collaborator Author

@joeldrapper joeldrapper commented on db970d1 Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to update Lookbook to support Phlex 2. I’m planning to work on it this week. It may make sense to open an issue over in the Lookbook repo.

@eminkel
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joeldrapper Thanks, I appreciate your work on this (and Phlex 2!). I went ahead and created an issue (lookbook-hq/lookbook#673)

Please sign in to comment.