Skip to content

Conversation

@gepolv
Copy link

@gepolv gepolv commented Mar 16, 2017

change "INDEX_OPTIONS" from "coreProductGridWorkflow" to "coreWorkflow".
Reason:
when the root path "/" is rendered in "ReactionLayout", it will look for combination of layout and workflow to retrieve template from collection "Shop". If "INDEX_OPTIONS" is "coreProductGridWorkflow", "ReactionLayout" will look for "coreLayout" and "coreProductGridWorkflow" in "Shop". Instead, we should retrieve "coreLayout" and "coreWorkflow".

Please provide the following information to help us approve your PR. Failure to provide this
information may result in your PR being closed without comment.

change "INDEX_OPTIONS" from "coreProductGridWorkflow" to "coreWorkflow".
Reason:
when the root path "/" is rendered in "ReactionLayout",  it will look for combination of layout and workflow to retrieve template from collection "Shop". If "INDEX_OPTIONS" is "coreProductGridWorkflow", "ReactionLayout" will look for "coreLayout" and "coreProductGridWorkflow" in "Shop". Instead, we should retrieve "coreLayout" and "coreWorkflow".
@CLAassistant
Copy link

CLAassistant commented Mar 16, 2017

CLA assistant check
All committers have signed the CLA.

@impactmass
Copy link
Contributor

Hi @gepolv,

I tested this and it still didn't solve the problem of the default template being used over the set custom one.

What is really happening here is that when there is a custom template defined (which means there are two matching Layouts - one being the default and the other the custom), the custom layout should be the one used in rendering. That selection happens here. So the solution should be to add logic to determine and use the custom layout.

@mikemurray
Copy link
Member

Perhaps logic, or maybe even some kinda UI to select the one you want, kinda like the template selector on the PDP page.

Copy link
Member

@mikemurray mikemurray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of the coreProductGridWorkflow is for the publish buttons for the product grid.

Changing it back to coreWorkflow would break that.

@impactmass
Copy link
Contributor

Thanks @mikemurray. I haven't considered using a UI like the PDP. But my guess it that, that would need to be considered properly, to determine if it's needed or not.

Considering that the issue (#1969) was labeled as "regression", there was a time it was using the custom template when available (over the default). Has there been any previous mention of having a template selector for this page?

@mikemurray
Copy link
Member

We've talked about the ability for users to select templates for anything. Consider users that use the PaaS only; they'll need a way to select different templates for pages as well.

In this case, the way the index page works is different from all others. At the very least, it needs to be in the registry so it can be overriden from the database.

@gepolv
Copy link
Author

gepolv commented Mar 17, 2017

@impactmass
Suppose we have installed the https://github.com/reactioncommerce/reaction-example-plugin .

To better explain the problem, I have two screenshots of Collection "Shop":
reactionshops1112

The first figure shows Item 11 and Item 12. Our current behavior is selecting Item 11 because layout is set as "coreLayoutBeesknees" and workflow is set as "coreProductGridWorkflow". As you can see, the "structure" under Item 11 is not correct.

reactionshop1213

This figure shows Item 12 and Item 13. As you can see, both have the same workflow and layout. however, their "structure"s are different. "Structure" under Item 12 is from the example plugin whose template is "productsLanding" defined https://github.com/reactioncommerce/reaction-example-plugin/blob/master/register.js#27.
"Structure" under Item 13 is the default one.
So Item 12 should be the correct result and should be selected.

Conclusion: the logic here is correct because Item 12 (custom plugin) comes before Item 13 (default one). What we need to do is to change "INDEX_OPTIONS" from "coreProductGridWorkflow" to "coreWorkflow", Item 12 will be selected and the issue mentioned in #1969 will be resolved.

@brent-hoover
Copy link
Collaborator

@gepolv I agree with your analysis of the problembut I don't agree with your solution. It would only patch this one case where it's grabbing the wrong layout record and not have any affect on other custom layouts. I think the real solution is to load records in such a way that "custom" layouts always override default ones when the records are loaded in the router here

We also should not be relying on load order as that is not something that we can assume will always be the same.

@gepolv
Copy link
Author

gepolv commented Mar 17, 2017

@zenweasel
Suppose we are able to overwrite the default layout+workflow, which means Item 12 will overwrite Item 13 in my Figure 2, in this case, what will be loaded by

const newLayout = shop.layout.find((x) => selectLayout(x, layout, workflow));
?
It is still Item 11 in Figure 1, which is still wrong.

You basically believe the default workflow should be "coreProductGridWorkflow". What is the reason behind this? In my opinion, "coreProductGridWorkflow" cannot be the default workflow. Instead, "coreWorkflow" should be the default workflow.

Correct me if I am wrong.
Thanks.

@aaronjudd aaronjudd changed the title change default "INDEX_OPTIONS" [WIP] change default "INDEX_OPTIONS" Mar 29, 2017
@brent-hoover brent-hoover changed the base branch from master to development April 4, 2017 03:20
@brent-hoover
Copy link
Collaborator

Tested this again and it still doesn't work. Closing as issue was fixed via #2023

@gepolv I am sorry we didn't see eye-to-eye on this, but the issue is fixed now, and we welcome your input in the future.

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.

6 participants