Users are encountering errors related to the Discourse composer when attempting to create new topics or replies. ivanrlio reports that post.get fails with “undefined key” when adding a reply, and post appears to be an object with a post number of (...), which resolves to 1. The same user later identifies that the issue stems from two plugins that reopen the composer controller. zogstrip suggests verifying whether post is an Ember object and recommends trying post.post_number instead. Separately, JQ331 describes a similar issue in local development: adding a custom “create topic” button breaks all such buttons site-wide, throwing the error Uncaught Error: Assertion Failed: The key provided to set must be a string or number, you passed undefined. Notably, the error persists even after removing the problematic code — only deleting the file entirely resolves it. Both issues appear to stem from plugin-related interference with the composer’s internal state or Ember object handling, suggesting a need to audit plugin code for improper object manipulation or reopens that break expected behavior.
في بيئة التطوير المحلية الخاصة بي، أثناء العمل على إضافة، أواجه سلوكًا غريبًا مشابهًا فيما يتعلق بـ Composer.
زر إنشاء موضوع يعمل في مثيل Discourse المحلي الخاص بي، لكن إذا حاولت إضافة زر إنشاء موضوع جديد في مكان آخر (وأضفت بعض الكود لجعل ذلك يحدث)، فإن الأمر يختل، وتتوقف جميع أزرار إنشاء الموضوع في الموقع (المحلي) عن العمل.
وأحصل على هذه الرسالة:
Uncaught Error: Assertion Failed: The key provided to set must be a string or number, you passed undefined
يستمر هذا الخطأ حتى لو قمت بإزالة الكود الذي أضفته والذي بدا أنه سبب الخطأ في المقام الأول. أي أنه بمجرد ظهور هذا الخطأ، حتى لو عدت بكامل الكود إلى حالته السابقة، يستمر الخطأ في الظهور في كل مرة أريد فيها الضغط على زر إنشاء موضوع.
الشيء الوحيد الذي أعتقد أنه يجعل الخطأ يختفي هو إزالة الملف بالكامل الذي يحتوي على الكود الجديد (لذا، عدم وجود الملف هناك يبدو أنه يعمل؛ بينما وجود الملف فارغًا دون أي كود يؤدي إلى استمرار الخطأ).
هل لدى أي شخص أي فكرة حول هذا الأمر؟ لقد كان عائقًا كبيرًا أمام تطوري.