Git Product home page Git Product logo

Comments (8)

akobashikawa avatar akobashikawa commented on August 15, 2024

I think html generated in callback via render in too late and function returns default empty output:

      if (template) {
        locals = locals || {};
        locals.messages = flash;
        res.render(template, locals, function (err, html) {
          if (html) {
            output = html;
          }
        });
      } else {
         //...
      }
      return output; // I THINK THIS LINE WINS TO CALLBACK IN RENDER

from express-messages.

artcommacode avatar artcommacode commented on August 15, 2024

Not quite sure what is going on here, paging @agraboso!

from express-messages.

davepwsmith avatar davepwsmith commented on August 15, 2024

Any movement on this?

from express-messages.

artcommacode avatar artcommacode commented on August 15, 2024

Paging @agraboso again!

from express-messages.

agraboso avatar agraboso commented on August 15, 2024

I believe @akobashikawa's assessment is correct. The obvious fix would be to render the template synchronously, but express disallows that by not exposing the rendering engine(s). We might have to simply import a templating library...

from express-messages.

artcommacode avatar artcommacode commented on August 15, 2024

Thanks @agraboso. Would that not end up to blocking the request though? Is there any way to handle this async? Maybe we could take in next and call that from within the function or change the signature to return our own callback?

from express-messages.

agraboso avatar agraboso commented on August 15, 2024

@artcommacode: I don't see how to do this async at all. After a good deal of thought, I think the best way to deal with this is to delegate rendering to the user in exactly the way flash does — so maybe we should deprecate this module and point users to flash.

from express-messages.

nahwinrajan avatar nahwinrajan commented on August 15, 2024

so we can't use custom template for this package ....

from express-messages.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.