1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 13:19:39 +02:00

Refresh account on update (#476)

* Refresh account on update

* 🐛 Replace turbo frame on create valuation

This avoids the frame reloading it's src when refreshing.

* Change Action Cable adapater to Postgres
This commit is contained in:
Josh Brown 2024-02-24 02:18:30 +00:00 committed by GitHub
parent 7e324f1b53
commit e767aca37f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 5 additions and 4 deletions

View file

@ -1,4 +1,5 @@
class Account < ApplicationRecord
broadcasts_refreshes
belongs_to :family
has_many :balances, class_name: "AccountBalance"
has_many :valuations

View file

@ -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 %>

View file

@ -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">

View file

@ -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 } %>

View file

@ -1,6 +1,5 @@
development:
adapter: redis
url: redis://localhost:6379/1
adapter: postgresql
test:
adapter: test