controller icon indicating copy to clipboard operation
controller copied to clipboard

Flash message appears twice (redux)

Open greggilbert opened this issue 5 years ago • 3 comments

Hey. Following #196, #260, etc., I'm having the double flash issue again in Hanami 1.3.1 (also 1.3.0).

module Web
  class Failure
    include Web::Action

    def call(params)
      # shortened for brevity
      msg = "Something went wrong, try again!"
      flash[:message] = msg
      redirect_to routes.login_path
    end
  end
end
module Web
  class Index
    include Web::Action
    include Hanami::Action::Session

    expose :message

    def call(params)

      message = flash[:message]
      if message
        @message = message
      end
    end
  end
end

As with some of the previous tickets, adding a before { flash.clear } fixes it. Am I not doing something right here?

greggilbert avatar Feb 09 '19 21:02 greggilbert

@GustavoCaso Would you mind to check if this is a flash regression? Thanks.

jodosha avatar Feb 12 '19 11:02 jodosha

@greggilbert What's the previous Hanami version you were on?

jodosha avatar Feb 12 '19 11:02 jodosha

@jodosha Of course. I will find some time this week to have a look at it.

@greggilbert would be able to provide a copy of your Gemfile?

GustavoCaso avatar Feb 24 '19 23:02 GustavoCaso