fix(conditional): huge perf improvement by caching champ visibility
Hyper nécessaire lorsqu'il y a des champs qui dépendent d'autres champs en cascade. Co-authored-by: simon lehericey <mail@simon.lehericey.net> Co-authored-by: mfo <martin@sharypic.com>
This commit is contained in:
parent
f262ac4cf3
commit
0a890acc33
1 changed files with 4 additions and 1 deletions
|
@ -214,7 +214,10 @@ class Champ < ApplicationRecord
|
|||
end
|
||||
|
||||
def visible?
|
||||
if conditional?
|
||||
# Huge gain perf for cascade conditions
|
||||
return @visible if instance_variable_defined? :@visible
|
||||
|
||||
@visible = if conditional?
|
||||
type_de_champ.condition.compute(champs_for_condition)
|
||||
else
|
||||
true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue