From e125faefbad44ba78c1e993ac172170d828f0d85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Arteiro?= Date: Thu, 10 Nov 2022 19:27:44 +0000 Subject: [PATCH] fix: Errors are cleared on another submit. #195. --- lib/app_web/live/app_live.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/app_web/live/app_live.ex b/lib/app_web/live/app_live.ex index 0a41ceae..9879213f 100644 --- a/lib/app_web/live/app_live.ex +++ b/lib/app_web/live/app_live.ex @@ -210,10 +210,12 @@ defmodule AppWeb.AppLive do changeset_error_key, changeset_error_message ) do - # Adding error to changeset + + # Clearing and adding error to changeset + cleared_changeset = Map.put(changeset_to_error, :errors, []) errored_changeset = Ecto.Changeset.add_error( - changeset_to_error, + cleared_changeset, changeset_error_key, changeset_error_message )