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

TypeError: Cannot convert undefined or null to object in waitForAllAttributesAndContinue #456

Closed
dengribar opened this issue Jan 9, 2024 · 3 comments · Fixed by #458
Closed
Assignees
Labels
bug confirmed We want to fix or implement it

Comments

@dengribar
Copy link

Summary

👋 After updating Blaze from 2.7.1 to 2.8.0 in our Meteor (v2.14) app, we got Cannot convert undefined or null to object error in waitForAllAttributesAndContinue function (ref):

image 28

In our case it happens when an HTML element has only one attribute and it's value is calculated by a Template helper function that returns undefined.

Steps to reproduce

  1. Create a Blaze app with command: meteor create --blaze simple-todos-blaze --prototype
  2. Add disabled helper to hello Template in main.js module:
Template.hello.helpers({
  disabled() {
    return undefined;
  },
  1. Add disabled attribute to button element in hello Template in main.html module:
<template name="hello">
  <button {{disabled}}>Click Me</button>
  1. Run the app

Actual behaviour

The app crashes in browser with the described error

Expected behaviour

The element should be rendered with no attributes

@jankapunkt
Copy link
Collaborator

jankapunkt commented Jan 9, 2024

Should be easily fixed by making attrs = {}, I can make a PR

@jankapunkt
Copy link
Collaborator

jankapunkt commented Jan 9, 2024

The issue actually comes from Blaze._expandAttributes which should return and empty Object, instead of null, when no atts were found to be expandable. Otherwise multiple functions will fail (including waitForAllAttributesAndContinue)

Edit: note the issue only occurs when the element has computed atts but no other atts being set. For example, <button title="foo" {{disabled}}>Click Me</button> would not cause the error.

Anyway, it's fixed: #458

@dengribar
Copy link
Author

This issue is fixed in Blaze 2.9.0, thanks to everyone involved! 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed We want to fix or implement it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants