The personal finance app for everyone
Refresh account on update (#476)
Josh Browne767aca37f51
diff --git a/app/models/account.rb b/app/models/account.rbindex 2b3eba50..bfc8dac1 100644--- a/app/models/account.rb+++ b/app/models/account.rb@@ -1,4 +1,5 @@class Account < ApplicationRecord+ broadcasts_refreshesbelongs_to :familyhas_many :balances, class_name: "AccountBalance"has_many :valuationsdiff --git a/app/views/accounts/_sync_message.html.erb b/app/views/accounts/_sync_message.html.erbindex 269c9518..fe0bf405 100644--- a/app/views/accounts/_sync_message.html.erb+++ b/app/views/accounts/_sync_message.html.erb@@ -2,7 +2,7 @@<% if is_syncing %><div class="my-4 px-8 py-4 rounded-lg bg-yellow-500/10 flex items-center justify-between"><p class="text-gray-900 text-sm">- Syncing your account balances. Please reload the page to see updated data.+ Syncing your account balances.</p></div><% end %>diff --git a/app/views/accounts/show.html.erb b/app/views/accounts/show.html.erbindex 76ba4f56..069e77a2 100644--- a/app/views/accounts/show.html.erb+++ b/app/views/accounts/show.html.erb@@ -1,3 +1,4 @@+<%= turbo_stream_from @account %><% balance_trend_styles = @balance_series.nil? ? {} : trend_styles(@balance_series[:trend]) %><div class="space-y-4"><div class="flex justify-between items-center">diff --git a/app/views/valuations/create.turbo_stream.erb b/app/views/valuations/create.turbo_stream.erbindex 03a83652..c6972c53 100644--- a/app/views/valuations/create.turbo_stream.erb+++ b/app/views/valuations/create.turbo_stream.erb@@ -1,4 +1,4 @@-<%= turbo_stream.update Valuation.new, "" %>+<%= turbo_stream.replace Valuation.new, body: turbo_frame_tag(dom_id(Valuation.new)) %><%= turbo_stream.append "notification-tray", partial: "shared/notification", locals: { type: "success", content: "Valuation created" } %><%= turbo_stream.replace "valuations_list", partial: "accounts/account_valuation_list", locals: { valuation_series: @account.valuation_series } %><%= turbo_stream.replace "sync_message", partial: "accounts/sync_message", locals: { is_syncing: true } %>diff --git a/config/cable.yml b/config/cable.ymlindex 536f3007..0250b01b 100644--- a/config/cable.yml+++ b/config/cable.yml@@ -1,6 +1,5 @@development:- adapter: redis- url: redis://localhost:6379/1+ adapter: postgresqltest:adapter: test