File tree Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,10 @@ def inertia_view_assigns
62
62
63
63
private
64
64
65
+ def inertia_configuration
66
+ ::InertiaRails . configuration
67
+ end
68
+
65
69
def inertia_layout
66
70
layout = ::InertiaRails . layout
67
71
Original file line number Diff line number Diff line change @@ -5,8 +5,7 @@ def initialize(app)
5
5
end
6
6
7
7
def call ( env )
8
- InertiaRailsRequest . new ( @app , env )
9
- . response
8
+ InertiaRailsRequest . new ( @app , env ) . response
10
9
ensure
11
10
::InertiaRails . reset!
12
11
end
@@ -60,11 +59,15 @@ def get?
60
59
request_method == 'GET'
61
60
end
62
61
62
+ def controller
63
+ @env [ "action_controller.instance" ]
64
+ end
65
+
63
66
def request_method
64
67
@env [ 'REQUEST_METHOD' ]
65
68
end
66
69
67
- def inertia_version
70
+ def client_version
68
71
@env [ 'HTTP_X_INERTIA_VERSION' ]
69
72
end
70
73
@@ -73,17 +76,15 @@ def inertia_request?
73
76
end
74
77
75
78
def version_stale?
76
- sent_version != saved_version
79
+ coerce_version ( client_version ) != coerce_version ( server_version )
77
80
end
78
81
79
- def sent_version
80
- return nil if inertia_version . nil?
81
-
82
- InertiaRails . version . is_a? ( Numeric ) ? inertia_version . to_f : inertia_version
82
+ def server_version
83
+ controller . send ( :inertia_configuration ) . version
83
84
end
84
85
85
- def saved_version
86
- InertiaRails . version . is_a? ( Numeric ) ? InertiaRails . version . to_f : InertiaRails . version
86
+ def coerce_version ( version )
87
+ server_version . is_a? ( Numeric ) ? version . to_f : version
87
88
end
88
89
89
90
def force_refresh ( request )
You can’t perform that action at this time.
0 commit comments