view_component 2.8.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of view_component might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +4 -4
- data/lib/view_component/base.rb +3 -4
- data/lib/view_component/compile_cache.rb +24 -0
- data/lib/view_component/engine.rb +4 -0
- data/lib/view_component/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc3f38e0c12dafc80bf6c2c9b74d09d3a3f019ee4d4a9dfa59d1a638a1228898
|
4
|
+
data.tar.gz: 48f1df9b4f54a0049b96e37b1ca16de5125ef13163838aa94cba4fb5cb6f8a1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7efa511f6cc6b76fed913823eb54d3ec709e3d8ca99adbcbc6cf6a667c407be4885701b68fc174fa2af3908d6da708c77c9cffa58de23f3f11307510e7cceb57
|
7
|
+
data.tar.gz: 238f0fd897c7125652cf80df6c59dcaa5d8bf5a1eb39d994a48a876be49cf0c43d5274eed3b2fbcf8915461ef1334dec9f92835b886e152e7eb64ab320b7049f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# master
|
2
2
|
|
3
|
+
# 2.9.0
|
4
|
+
|
5
|
+
* Cache components per-request in development, preventing unnecessary recompilation during a single request.
|
6
|
+
|
7
|
+
*Felipe Sateler*
|
8
|
+
|
3
9
|
# 2.8.0
|
4
10
|
|
5
11
|
* Add `before_render`, deprecating `before_render_check`.
|
@@ -10,7 +16,7 @@
|
|
10
16
|
|
11
17
|
* Add `rendered_component` method to `ViewComponent::TestHelpers` which exposes the raw output of the rendered component.
|
12
18
|
|
13
|
-
|
19
|
+
*Richard Macklin*
|
14
20
|
|
15
21
|
* Support sidecar directories for views and other assets.
|
16
22
|
|
data/README.md
CHANGED
@@ -778,10 +778,10 @@ ViewComponent is built by:
|
|
778
778
|
|@blakewilliams|@seanpdoyle|@tclem|@nashby|@jaredcwhite|
|
779
779
|
|Boston, MA|New York, NY|San Francisco, CA|Minsk|Portland, OR|
|
780
780
|
|
781
|
-
|<img src="https://avatars.githubusercontent.com/simonrand?s=256" alt="simonrand" width="128" />|<img src="https://avatars.githubusercontent.com/fugufish?s=256" alt="fugufish" width="128" />|<img src="https://avatars.githubusercontent.com/cover?s=256" alt="cover" width="128" />|<img src="https://avatars.githubusercontent.com/franks921?s=256" alt="franks921" width="128" />|
|
782
|
-
|
783
|
-
|@simonrand|@fugufish|@cover|@franks921|
|
784
|
-
|Dublin, Ireland|Salt Lake City, Utah|Barcelona|South Africa|
|
781
|
+
|<img src="https://avatars.githubusercontent.com/simonrand?s=256" alt="simonrand" width="128" />|<img src="https://avatars.githubusercontent.com/fugufish?s=256" alt="fugufish" width="128" />|<img src="https://avatars.githubusercontent.com/cover?s=256" alt="cover" width="128" />|<img src="https://avatars.githubusercontent.com/franks921?s=256" alt="franks921" width="128" />|<img src="https://avatars.githubusercontent.com/fsateler?s=256" alt="fsateler" width="128" />|
|
782
|
+
|:---:|:---:|:---:|:---:|:---:|
|
783
|
+
|@simonrand|@fugufish|@cover|@franks921|@fsateler|
|
784
|
+
|Dublin, Ireland|Salt Lake City, Utah|Barcelona|South Africa|Chile|
|
785
785
|
|
786
786
|
## License
|
787
787
|
|
data/lib/view_component/base.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require "action_view"
|
4
4
|
require "active_support/configurable"
|
5
5
|
require "view_component/collection"
|
6
|
+
require "view_component/compile_cache"
|
6
7
|
require "view_component/previewable"
|
7
8
|
|
8
9
|
module ViewComponent
|
@@ -192,9 +193,7 @@ module ViewComponent
|
|
192
193
|
end
|
193
194
|
|
194
195
|
def compiled?
|
195
|
-
|
196
|
-
|
197
|
-
@compiled && ActionView::Base.cache_template_loading
|
196
|
+
CompileCache.compiled?(self)
|
198
197
|
end
|
199
198
|
|
200
199
|
# Compile templates to instance methods, assuming they haven't been compiled already.
|
@@ -270,7 +269,7 @@ module ViewComponent
|
|
270
269
|
RUBY
|
271
270
|
end
|
272
271
|
|
273
|
-
|
272
|
+
CompileCache.register self
|
274
273
|
end
|
275
274
|
|
276
275
|
# we'll eventually want to update this to support other types
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ViewComponent
|
4
|
+
# Keeps track of which templates have already been compiled
|
5
|
+
# This is not part of the public API
|
6
|
+
module CompileCache
|
7
|
+
mattr_accessor :cache, instance_reader: false, instance_accessor: false do
|
8
|
+
Set.new
|
9
|
+
end
|
10
|
+
module_function
|
11
|
+
|
12
|
+
def register(klass)
|
13
|
+
cache << klass
|
14
|
+
end
|
15
|
+
|
16
|
+
def compiled?(klass)
|
17
|
+
cache.include? klass
|
18
|
+
end
|
19
|
+
|
20
|
+
def invalidate!
|
21
|
+
cache.clear
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -69,6 +69,10 @@ module ViewComponent
|
|
69
69
|
get "#{options.preview_route}/*path", to: "view_components#previews", as: :preview_view_component, internal: true
|
70
70
|
end
|
71
71
|
end
|
72
|
+
|
73
|
+
app.executor.to_run :before do
|
74
|
+
CompileCache.invalidate! unless ActionView::Base.cache_template_loading
|
75
|
+
end
|
72
76
|
end
|
73
77
|
end
|
74
78
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: view_component
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -200,6 +200,7 @@ files:
|
|
200
200
|
- lib/view_component.rb
|
201
201
|
- lib/view_component/base.rb
|
202
202
|
- lib/view_component/collection.rb
|
203
|
+
- lib/view_component/compile_cache.rb
|
203
204
|
- lib/view_component/engine.rb
|
204
205
|
- lib/view_component/preview.rb
|
205
206
|
- lib/view_component/previewable.rb
|