You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@alexandersimoes indicated to me that for some users, the permalinks are not working (example here). Here are a few of my thoughts on the issue to give you some places to get started.
Where to start
Firstly, the component to start in would be Share.jsx. This is where the permalink pages are rendered. There are only two places in that file where the 404 could come back:
Line 65 and 67 show you the places where the <Error> page returns. In the first case, it is if neither a project nor codeblock was found for the need request (see below for more info on need) . In the second case, we access the first element of that content array, which should contain the html content. If it doesn't, we return a 404.
More on Needs
A need is a special request made by canon which says "Before you render this page, promise me that you will make these requests." As you can see, given the username and filename from the url, we attempt to hit our internal API and fetch this user's content.
Interestingly, for this user's content, these API endpoints are actually functioning. If you look here and here, these are the raw API results, and the data is indeed coming through.
Possible explanations
So, it the API call is functioning, then why isn't the page rendering? I have two potential ideas for why this might be the case:
Something about the accent in the username is causing the fetchData function in the need to fail. This would mean that there could potentially be some error in canon that is not building the URL correctly. If this is the case, we would be able to issue you a fix for this, or at least instructions for a workaround or patch.
Something is wrong with the pathing check we are doing here. As you can see, this line of code checks the url and asks, "are trying to render a codeblock or a project?" The answer to this question is then used here to determine which data to use. If for some reason this path check is failing, it will default to a project. When we try to find a project with this filename, it won't be found, because we're SUPPOSED to be looking for a codeblock.
Next steps
The first thing to do would be to add some console.log:
contentType - is this variable properly being set to "codeBlocks"? What is the value of the pathname variable when we check it?
codeblockContent and projectContent - what are the value of these variables? Is our content coming through at all? I would be interested to learn whether it's line 65 or line 67 that is the culprit for rendering that 404.
Conclusions
If you'd like to post the output of those console logs to this issue, I can continue to give you my thoughts on what the root cause is.
Best of luck,
Jimmy
The text was updated successfully, but these errors were encountered:
@WellisonRodrigues
@alexandersimoes indicated to me that for some users, the permalinks are not working (example here). Here are a few of my thoughts on the issue to give you some places to get started.
Where to start
Firstly, the component to start in would be Share.jsx. This is where the permalink pages are rendered. There are only two places in that file where the 404 could come back:
https://github.com/CodeLifeOrg/codelife/blob/master/app/pages/Share.jsx#L65-L67
Line 65 and 67 show you the places where the
<Error>
page returns. In the first case, it is if neither a project nor codeblock was found for theneed
request (see below for more info onneed
) . In the second case, we access the first element of that content array, which should contain the html content. If it doesn't, we return a 404.More on
Needs
A
need
is a special request made by canon which says "Before you render this page, promise me that you will make these requests." As you can see, given theusername
andfilename
from the url, we attempt to hit our internal API and fetch this user's content.Interestingly, for this user's content, these API endpoints are actually functioning. If you look here and here, these are the raw API results, and the data is indeed coming through.
Possible explanations
So, it the API call is functioning, then why isn't the page rendering? I have two potential ideas for why this might be the case:
Something about the accent in the username is causing the
fetchData
function in theneed
to fail. This would mean that there could potentially be some error incanon
that is not building the URL correctly. If this is the case, we would be able to issue you a fix for this, or at least instructions for a workaround or patch.Something is wrong with the pathing check we are doing here. As you can see, this line of code checks the url and asks, "are trying to render a codeblock or a project?" The answer to this question is then used here to determine which data to use. If for some reason this path check is failing, it will default to a
project
. When we try to find aproject
with this filename, it won't be found, because we're SUPPOSED to be looking for acodeblock
.Next steps
The first thing to do would be to add some
console.log
:contentType
- is this variable properly being set to "codeBlocks"? What is the value of thepathname
variable when we check it?codeblockContent
andprojectContent
- what are the value of these variables? Is our content coming through at all? I would be interested to learn whether it's line 65 or line 67 that is the culprit for rendering that 404.Conclusions
If you'd like to post the output of those console logs to this issue, I can continue to give you my thoughts on what the root cause is.
Best of luck,
Jimmy
The text was updated successfully, but these errors were encountered: