In a Discourse development discussion, users explore the difference between .hbs and .raw.hbs (or .hbr) Handlebars templates. net_deamon notes that some plugin outlets (like topic-list-after-title) use {{raw-plugin-outlet}}, requiring .raw.hbs files, while others use {{plugin-outlet}} with standard .hbs files. sam clarifies that raw templates are a performance optimization—they lack full Ember lifecycle features like setupComponent, making them faster but less flexible. spirobel asks about alternatives to setupComponent and computed properties in raw templates; they later find a workaround by reopening models to add computed properties accessible in .raw.hbs. merefield questions whether raw templates can be backed by JavaScript components like regular ones. They discover that some components (e.g., topic-list-item) use .hbs templates that render .hbr templates via JavaScript, suggesting raw templates don’t directly support JS unless manually bridged. markvanlan recommends using helpers for JS logic in raw templates, citing an example from the discourse-category-experts plugin. merefield reports switching some .hbr to .hbs to enable closure actions for passing data up the component tree, despite performance trade-offs. markvanlan and merefield discuss whether helpers can handle upward data flow, with merefield noting the need to persist computed image properties from leaf components to grandparent for styling. In summary, raw templates offer speed but limited interactivity; JS logic must be added via helpers or model extensions, or avoided by using full .hbs components when complex data flow is needed.
setupComponent(args, component)와 유사한 것이 원시(raw) 아웃렛에서도 사용할 수 있나요? 계산 속성(computed properties)은 어떻게 되나요? 컨텍스트의 데이터를 기반으로 몇 가지 계산을 수행하고 싶습니다. 어떻게 해야 할까요? 내가 만든 accompanying .js.es6 파일의 이름이 맞는지조차 모르겠습니다. .raw.js.es6로 이름 붙여야 하나요?
구체적으로, 리프 컴포넌트에서 이미지의 속성을 결정하고, 이를 조부모 컴포넌트의 속성으로 저장하여 현재 리스트 렌더링 이후에도 유지되어야 하는 스타일링에 영향을 주고자 합니다. 데이터는 반드시 위로 전달되어야 합니다. 만약 현재 접근 방식으로 막혀 있다면 헬퍼 함수로 이를 달성할 수 있다면 좋은 옵션이 될 것 같습니다. 감사합니다!