Skip to content

Commit

Permalink
Merge pull request #565 from scarpe-team/revisit
Browse files Browse the repository at this point in the history
Implement feedback from `page` PR
  • Loading branch information
Schwad authored Oct 9, 2024
2 parents 3f9119c + 2862555 commit d1d3a5a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
7 changes: 2 additions & 5 deletions lacci/lib/shoes/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,7 @@ def init
send_shoes_event(event_name: "init")
return if @do_shutdown

with_slot(@document_root) do
@content_container = flow(width: 1.0, height: 1.0)
with_slot(@content_container, &@app_code_body)
end
with_slot(@document_root, &@app_code_body)
end

# "Container" drawables like flows, stacks, masks and the document root
Expand Down Expand Up @@ -290,7 +287,7 @@ def page(name, &block)

def visit(name)
if @pages && @pages[name]
@content_container.clear do
@document_root.clear do
instance_eval(&@pages[name])
end
else
Expand Down
14 changes: 8 additions & 6 deletions lacci/lib/shoes/drawable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,17 @@ def shoes_style_name?(name)
# not kept long, and used up when used once.

def with_current_app(app)
old_app = Thread.current[:shoes_app]
Thread.current[:shoes_app] = app
yield
ensure
Thread.current[:shoes_app] = old_app
old_cur_app = @current_app
@current_app = app
ret = yield
@current_app = old_cur_app
ret
end

def use_current_app
Thread.current[:shoes_app]
cur_app = @current_app
@current_app = nil
cur_app
end
end

Expand Down

0 comments on commit d1d3a5a

Please sign in to comment.