admin: drop the warm-up render from the phlex require
The view_template redefinition costs more than the two lines of
noise it saves; the warnings are accepted until phlex fixes them.
Assisted-by: GLM-5.3 via pi
diff --git a/lib/pro_tacts/admin/phlex.rb b/lib/pro_tacts/admin/phlex.rb
index 387c04f..aa13b18 100644
--- a/lib/pro_tacts/admin/phlex.rb
+++ b/lib/pro_tacts/admin/phlex.rb
@@ -9,19 +9,15 @@ require "pro_tacts/warnings"
# instead of phlex, and every later require or autoload hit is a
# no-op. sgml/state is in the set because it loads later still, at
# the first render, and carries its own warning.
+#
+# Two warnings survive on purpose: sgml.rb passes &block to
+# before_template and after_template, which ignore it, and Ruby warns
+# once per process at the first render carrying a content block. The
+# only way to spend that render inside the silence is a throwaway
+# component redefining view_template at require time, which costs more
+# than the two lines of noise it saves.
ProTacts.silence_warnings do
require "phlex"
require "phlex/html"
require "phlex/sgml/state"
-
- # Two warnings survive the requires: sgml.rb passes &block to
- # before_template and after_template, methods that ignore it, and
- # Ruby warns once per process at the first render carrying a
- # content block -- the render(Layout.new) { ... } shape every
- # screen here uses. Spending that first render now, on a throwaway
- # component whose output is discarded, means no later one warns.
- inner = Class.new(Phlex::HTML) { def view_template; h1 { "warm" }; end }
- Class.new(Phlex::HTML) do
- define_method(:view_template) { render inner.new { nil } }
- end.new.call
end