Module: InertiaJb::Helper

Defined in:
lib/inertia_jb/helper.rb

Overview

Optional syntax sugar available inside .html.inertia templates, so you can write optional { ... } instead of InertiaRails.optional { ... }.

These simply delegate to the InertiaRails factory methods; the returned prop objects are resolved by InertiaRails::PropsResolver when the page is built (respecting partial reloads, grouping, etc.).

Instance Method Summary collapse

Instance Method Details

#always(&block) ⇒ Object

Always fetched, even when not requested in a partial reload.



17
18
19
# File 'lib/inertia_jb/helper.rb', line 17

def always(&block)
  ::InertiaRails.always(&block)
end

#deep_mergeObject

Deep-merged with existing client-side data.



37
38
39
# File 'lib/inertia_jb/helper.rb', line 37

def deep_merge(...)
  ::InertiaRails.deep_merge(...)
end

#deferObject

Excluded from the initial load; fetched in a follow-up request.



22
23
24
# File 'lib/inertia_jb/helper.rb', line 22

def defer(...)
  ::InertiaRails.defer(...)
end

#mergeObject

Merged with existing client-side data instead of replacing it.



32
33
34
# File 'lib/inertia_jb/helper.rb', line 32

def merge(...)
  ::InertiaRails.merge(...)
end

#optional(&block) ⇒ Object

Only fetched when explicitly requested in a partial reload.



12
13
14
# File 'lib/inertia_jb/helper.rb', line 12

def optional(&block)
  ::InertiaRails.optional(&block)
end

#scrollObject

Infinite-scroll prop (accepts a paginator or explicit metadata).



27
28
29
# File 'lib/inertia_jb/helper.rb', line 27

def scroll(...)
  ::InertiaRails.scroll(...)
end