The user NateDhaliwal initially struggled with api.renderInOutlet not rendering a component in Discourse. After realizing a file naming issue (missing hyphen in api-initializers), they moved on to debugging a Glimmer component that still wasn’t appearing. Despite no console errors, the component was not visible. After fixing ESLint and Prettier warnings, they discovered the component was rendered but hidden due to CSS. Adding display: block !important made it visible, and they later fixed the styling. The component now renders correctly, and manuel suggests using optional chaining to avoid undefined errors.
Ik raak echt in paniek. Ik probeer een .gjs-component te renderen, maar die verschijnt niet. Ik heb geprobeerd te renderen in template tags <h1>Hi</h1>, maar zelfs dat verschijnt niet. Wat is er aan de hand?
Ik weet niet zeker wat je huidige code is na je correcties, maar gezien de waarschuwing die je krijgt, zou de .category-title-header div op zijn minst in de DOM moeten worden weergegeven.
Ik raad aan de pagina in je browser te inspecteren. Probeer ook een paar console.log statements toe te voegen om te zien waar de applicatie de code bereikt. Als alternatief is er de Ember Inspector browser-extensie beschikbaar voor Chrome en Firefox, waarmee je de componentenboom kunt lezen.
If you can, the easiest way to get feedback on this would be to share your repo. The files you shared above are not stand-alone and require a settings file as well.
@Alteras It’s actually there, but not showing for some reason. Adding display: block !important made it appear, but the styling is now quite different
EDIT: Got the CSS fixed, and the headers are now displaying. Thanks so much @merefield@Alteras@manuel !
I still get some undefined errors in the console. You should use optional chaining with the ?. operator when looking up nested structures. For example: