question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

empty flash messages

See original GitHub issue

hi,

I would like to make use of keystone’s flash messages, however the displayed messages end up empty:

// what file is this? routes/views/index.js ? - Harry Moreno
var keystone = require('keystone');

exports = module.exports = function(req, res) {
    var view = new keystone.View(req, res);
    var locals = res.locals;

    locals.section = 'forum';

    view.on('init', function(next) {
        keystone.list('ForumThread').model
            .findOne({'slug': req.params.slug})
            .exec(function(err, result) {
                if (err) { return next(err); }
                if (!result) { 
                    req.flash('warning', 'Thread not found.');
                } else {
                    locals.thread = result;
                }               
                next();
            });
    });

    view.render('thread');
};

screen shot 2015-01-09 at 14 13 25

any idea what’s going wrong here?

thanks a lot in advance.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jstockwincommented, May 15, 2016

If you use the object format, does the error display on /keystone/signin, or can you only achieve one or the other? req.flash('error', { detail: 'You cannot access that page.' });

0reactions
mxstbrcommented, May 15, 2016

I wasn’t involved when any of these decisions was taken, so I can’t really comment. @JedWatson?

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to clear existing flash messages in Flask - Stack Overflow
This way you can clear the flash message as there is no predefined method to clear the flash message in Flask flash helpers....
Read more >
Empty Flash Messages - Apple Support Communities
I've been getting these empty Flash messages on my iphone 11 and I can't seem to find the reason for it. Anyone has...
Read more >
10. Message Flashing — Flask API - GitHub Pages
10. Message Flashing¶ ... Flashes a message to the next request. In order to remove the flashed message from the session and to...
Read more >
Message Flashing — Flask Documentation (2.2.x)
The flashing system basically makes it possible to record a message at the end of a request and access it next request and...
Read more >
How To Use Messages With Flask - Flask Fridays #6 - YouTube
We'll also look at using Bootstrap to style the flash messages, and make them delete -able and fade-able. Timecodes 0:00​ - Introduction 1:04 ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found