Commit 82782873 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Properly cleaning up memoized values

parent c3fa3e05
...@@ -44,8 +44,10 @@ module ResolvableDiscussion ...@@ -44,8 +44,10 @@ module ResolvableDiscussion
end end
def first_note def first_note
strong_memoize(:first_note) do
notes.first notes.first
end end
end
def first_note_to_resolve def first_note_to_resolve
return unless resolvable? return unless resolvable?
...@@ -102,8 +104,8 @@ module ResolvableDiscussion ...@@ -102,8 +104,8 @@ module ResolvableDiscussion
# Set the notes array to the updated notes # Set the notes array to the updated notes
@notes = notes_relation.fresh.to_a # rubocop:disable Gitlab/ModuleWithInstanceVariables @notes = notes_relation.fresh.to_a # rubocop:disable Gitlab/ModuleWithInstanceVariables
self.class.memoized_values.each do |var| self.class.memoized_values.each do |name|
instance_variable_set(:"@#{var}", nil) clear_memoization(name)
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment