Module: ReactOnRails::RenderingStrategy Abstract
- Included in:
- ExecJsStrategy
- Defined in:
- lib/react_on_rails/rendering_strategy.rb,
lib/react_on_rails/rendering_strategy/exec_js_strategy.rb
Overview
Include this module and implement all instance methods in your concrete strategy class. Methods are instance methods, not class methods.
Strategy interface for server-side rendering. Concrete strategies implement the rendering pipeline (JS execution, caching, streaming) for a specific runtime (ExecJS, Node renderer, etc.).
Configured once at boot time via engine initializers, replacing runtime ‘react_on_rails_pro?` checks.
Part of the strategy pattern refactoring (see issue #2905). Currently additive — not yet wired into the main rendering path.
Defined Under Namespace
Classes: ExecJsStrategy
Instance Method Summary collapse
-
#execute(render_request) ⇒ Hash, Stream
Execute a server render.
-
#reset ⇒ Object
Reset the rendering pool (e.g., after configuration changes).
-
#reset_if_bundle_changed ⇒ Object
Check if the server bundle has changed and reset the pool if so.
Instance Method Details
#execute(render_request) ⇒ Hash, Stream
Execute a server render. :nocov:
24 25 26 |
# File 'lib/react_on_rails/rendering_strategy.rb', line 24 def execute(render_request) raise NotImplementedError, "#{self.class}#execute must be implemented" end |
#reset ⇒ Object
Reset the rendering pool (e.g., after configuration changes). :nocov:
31 32 33 |
# File 'lib/react_on_rails/rendering_strategy.rb', line 31 def reset raise NotImplementedError, "#{self.class}#reset must be implemented" end |
#reset_if_bundle_changed ⇒ Object
Check if the server bundle has changed and reset the pool if so. Used in development mode to pick up bundle changes without restarting. :nocov:
39 40 41 |
# File 'lib/react_on_rails/rendering_strategy.rb', line 39 def reset_if_bundle_changed raise NotImplementedError, "#{self.class}#reset_if_bundle_changed must be implemented" end |