Skip to content

Make template lookup more confident#60

Open
julianrubisch wants to merge 7 commits into
joshleblanc:masterfrom
julianrubisch:template-lookup
Open

Make template lookup more confident#60
julianrubisch wants to merge 7 commits into
joshleblanc:masterfrom
julianrubisch:template-lookup

Conversation

@julianrubisch

Copy link
Copy Markdown
Contributor

By trying to get a template matching self.class.name.underscore first.

This fixes inline rendered views (i.e., without a top-level view file)

@joshleblanc

Copy link
Copy Markdown
Owner

That method is actually looking for the template that rendered the component, not the template that the component renders.

It's the differeniate between different component instances

# index.html.erb

<%= render MyComponent.new %> # index.html.erb:1 <- unique identifier
<% render MyComponent.new %> # index.html.erb:2 <- unique identifier

@julianrubisch

Copy link
Copy Markdown
Contributor Author

Hmmm so I need to approach that differently.

Any idea what could work?

@joshleblanc

Copy link
Copy Markdown
Owner

Providing the key manually through collection_key is the only solution I've come up with so far. It's something I wnated to solve for Ilex, but I haven't had any good thoughts so far.

My knee-jerk reaction is to just always use second call in the call stack, because that's always going to be what's rendering the component, but I seem to recall trying that initially and running into problems. It might have had something to do with debuggers not playing nicely...

Definitely something to check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants