Fix issue with channel connection on transactions

pull/816/head
Stamates 6 years ago
parent b338158dd8
commit 5af6dfa7e2
  1. 4
      apps/block_scout_web/assets/js/pages/transaction.js
  2. 10
      apps/block_scout_web/lib/block_scout_web/channels/transaction_channel.ex

@ -153,7 +153,7 @@ if ($transactionPendingListPage.length) {
const pendingTransactionsChannel = socket.channel(`transactions:new_pending_transaction`)
pendingTransactionsChannel.join()
pendingTransactionsChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' }))
pendingTransactionsChannel.on('new_pending_transaction', batchChannel((msgs) =>
pendingTransactionsChannel.on('pending_transaction', batchChannel((msgs) =>
store.dispatch({ type: 'RECEIVED_NEW_PENDING_TRANSACTION_BATCH', msgs: humps.camelizeKeys(msgs) }))
)
},
@ -215,7 +215,7 @@ if ($transactionListPage.length) {
const transactionsChannel = socket.channel(`transactions:new_transaction`)
transactionsChannel.join()
transactionsChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' }))
transactionsChannel.on('new_transaction', batchChannel((msgs) =>
transactionsChannel.on('transaction', batchChannel((msgs) =>
store.dispatch({ type: 'RECEIVED_NEW_TRANSACTION_BATCH', msgs: humps.camelizeKeys(msgs) }))
)
},

@ -8,7 +8,7 @@ defmodule BlockScoutWeb.TransactionChannel do
alias Explorer.Chain.Hash
alias Phoenix.View
intercept(["new_pending_transaction", "new_transaction"])
intercept(["pending_transaction", "transaction"])
def join("transactions:new_transaction", _params, socket) do
{:ok, %{}, socket}
@ -22,7 +22,7 @@ defmodule BlockScoutWeb.TransactionChannel do
{:ok, %{}, socket}
end
def handle_out("new_pending_transaction", %{transaction: transaction}, socket) do
def handle_out("pending_transaction", %{transaction: transaction}, socket) do
Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale)
rendered_transaction =
@ -32,7 +32,7 @@ defmodule BlockScoutWeb.TransactionChannel do
transaction: transaction
)
push(socket, "new_pending_transaction", %{
push(socket, "pending_transaction", %{
transaction_hash: Hash.to_string(transaction.hash),
transaction_html: rendered_transaction
})
@ -40,7 +40,7 @@ defmodule BlockScoutWeb.TransactionChannel do
{:noreply, socket}
end
def handle_out("new_transaction", %{transaction: transaction}, socket) do
def handle_out("transaction", %{transaction: transaction}, socket) do
Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale)
rendered_transaction =
@ -50,7 +50,7 @@ defmodule BlockScoutWeb.TransactionChannel do
transaction: transaction
)
push(socket, "new_transaction", %{
push(socket, "transaction", %{
transaction_hash: Hash.to_string(transaction.hash),
transaction_html: rendered_transaction
})

Loading…
Cancel
Save