From a74e3799f6725de280688c73dcba1f04a57bf61d Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Mon, 7 Oct 2024 09:27:49 +0100 Subject: [PATCH] Memoise empty address options result (#2675) --- app/models/log.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/log.rb b/app/models/log.rb index cb66074cf..aed375117 100644 --- a/app/models/log.rb +++ b/app/models/log.rb @@ -130,7 +130,10 @@ class Log < ApplicationRecord if [address_line1_input, postcode_full_input].all?(&:present?) service = AddressClient.new(address_string) service.call - return nil if service.result.blank? || service.error.present? + if service.result.blank? || service.error.present? + @address_options = [] + return @answer_options + end address_opts = [] service.result.first(10).each do |result|