Skip to content

Commit

Permalink
Remove useless memoization
Browse files Browse the repository at this point in the history
Everywhere the `details` method is being called is not re-computing the
response, therefore the memoization is pointless.

Removing it here, to avoid the unnecessary compute needed to check
whether the instance variable has already been set.
  • Loading branch information
brucebolt committed Feb 19, 2025
1 parent b313a0c commit a89216a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions app/presenters/details_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ def initialize(content_item_details, change_history_presenter, content_embed_pre
end

def details
@details ||=
begin
updated = content_embed(content_item_details).presence || content_item_details
updated = recursively_transform_govspeak(updated)
updated[:change_history] = change_history if change_history.present?
updated
end
updated = content_embed(content_item_details).presence || content_item_details
updated = recursively_transform_govspeak(updated)
updated[:change_history] = change_history if change_history.present?
updated
end

private
Expand Down

0 comments on commit a89216a

Please sign in to comment.