Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] broken flash messages #14

Open
Ciki opened this issue Sep 26, 2014 · 7 comments
Open

[bug] broken flash messages #14

Ciki opened this issue Sep 26, 2014 · 7 comments

Comments

@Ciki
Copy link

Ciki commented Sep 26, 2014

If I use sth. like this in presenter

$this->flashMessage('test');
$this->redirect('this');

the flash message will not show up as corresponding snippet (flashes) is not set to be redrawn after forwarding.

The workaround is to check for _fid in startup method

if (!empty($this->params[self::FLASH_KEY])) {
    $this->redrawControl('flashes');
}

but I lost more than hour to track this down..would be nice to mention this at least somewhere

@Majkl578
Copy link

That is not a bug. It's your responsibility to invalidate snippets. Flash messages are not tied to output in any way.

@Ciki
Copy link
Author

Ciki commented Sep 26, 2014

ok, I forgot that line in previous example..

$this->flashMessage('test');
$this->redrawControl('flashes');
$this->redirect('this');

after redirect the snippet is not invalidated.. (which is without this extension..)

@vojtech-dobes
Copy link
Owner

The thing about this extension is, that if you make redirect, you make redirect :). Therefore you have to take care of this invalidation in the destination of the redirect (in the newly created app request).

@vojtech-dobes
Copy link
Owner

after redirect the snippet is not invalidated.. (which is without this extension..)

That's true, but without this extension, this invalidated snippet is discarded immediately by actual redirect in the browser. So with this extension, you have to think about it bit different.

@Ciki
Copy link
Author

Ciki commented Sep 28, 2014

I see now but haven't realized when I used this extension for the first time. Now it seems obvious but it was not when I was hunting the 'bug' down :) All I'm asking is if any mention in readme of how this extension works & what to be aware of (need of snippet invalidation after 'redirect') would not be helpful for first-time users like I was..

@vojtech-dobes
Copy link
Owner

Noted. I will try to update readme soon :).

@Ciki
Copy link
Author

Ciki commented Sep 28, 2014

Thx ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants