Giter Club home page Giter Club logo

Comments (3)

Raynos avatar Raynos commented on May 4, 2024

CoffeeScript :(

You realize that developers would prefer to read and debug JavaScript right?

from meteor.

lvh avatar lvh commented on May 4, 2024

No, sorry, I didn't.

Additionally, although I did think about people who wanted to read JS, I forgot that the deployed thing had the minified (and hence useless) JS.

Would you like me to push the code somewhere so you can run it in development where you could see the changes live?

I have since changed the code to work around this using a helper function, but the basic idea should still be pretty obvious. Basically humaneDate raises TypeError because of a missing method, because it expects either a string representation of a date or a Date object, not {}. humanTime just catches that and returns "just now" (because it only happens when the messages are shiny new)

Both the coffeescript and the compiled JS are available in a gist.

Just to be clear: it works fine for older messages, it only fails when I insert a new Message and that causes an update of conversation.messages.

from meteor.

debergalis avatar debergalis commented on May 4, 2024

This is not supposed to work.

Here's what's probably happening.

new Date() on the client returns an Object. Minimongo only stores JSON values. So the insert is dropping that (should be an error) and you get an empty timestamp field.

The insert RPC to the server stringifies its arguments, so you're actually sending the string representation of the date to the server. (This is also probably wrong.) The server inserts a document into the MongoDB collection, then publishes it back to the client, which replaces its copy with a new version that includes the timestamp field. Hence the flicker.

Closing this bug. We should throw errors on minimongo insert and update where the doc isn't JSON. And we should clarify the behavior of the wire protocol.

from meteor.

Related Issues (20)

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.