Closed Bug 834055 Opened 11 years ago Closed 10 years ago

Page template duplicates areas

Categories

(developer.mozilla.org Graveyard :: KumaScript, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gmauer, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.27 (KHTML, like Gecko) Chrome/26.0.1386.0 Safari/537.27

Steps to reproduce:

See

https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp#RegExp_instances



Actual results:


The properties section is duplicated but the code is:
Properties

{{page('en/JavaScript/Reference/Global_Objects/RegExp/prototype','Properties')}}
Methods

{{page('en/JavaScript/Reference/Global_Objects/RegExp/prototype','Methods')}}



Expected results:


Following that link, the destination page seems correct. It seems like this template is broken
Any thoughts here sheppy?
It looks correct to me; I don't see this duplication at all. My guess is that George has a cached version of the page from before we fixed the template (which was done ages ago).
I sometimes stumble upon this duplication as well. Force-refreshing the page of course fixes this. Wondering if the caching is working correctly here or if we can improve it.

The macro module lives here
https://developer.mozilla.org/en-US/docs/Template:DekiScript:Wiki

Steps to reproduce for me were:
1) Edit https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
2) Insert {{page}} macro and save.
3) Force refresh.
4) Edit the page again (other corrections) and save.
5) See that {{page}} includes are duplicated again.
6) Force-refresh again.
Status: UNCONFIRMED → NEW
Component: General → KumaScript
Ever confirmed: true
(In reply to Florian Scholz [:fscholz] (elchi3) from comment #3)
> I sometimes stumble upon this duplication as well. Force-refreshing the page
> of course fixes this. Wondering if the caching is working correctly here or
> if we can improve it.
> 
> The macro module lives here
> https://developer.mozilla.org/en-US/docs/Template:DekiScript:Wiki
> 
> Steps to reproduce for me were:
> 1) Edit
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/
> Global_Objects/Array
> 2) Insert {{page}} macro and save.
> 3) Force refresh.
> 4) Edit the page again (other corrections) and save.
> 5) See that {{page}} includes are duplicated again.
> 6) Force-refresh again.

I think this is working as expected... The page macro actually lives here:

https://developer.mozilla.org/en-US/docs/Template:page

When I insert {{page}}, I get an instance of the root page of the site inserted because there was no URL supplied. I'm not seeing any kind of duplication
(In reply to Les Orchard [:lorchard] from comment #4)
> When I insert {{page}}, I get an instance of the root page of the site
> inserted because there was no URL supplied. I'm not seeing any kind of
> duplication

My description was not precise enough. Try to add these three macro calls into a document. Note that now all three render the first section #Mutator_methods. They do render the correct three different sections if you force-refresh.

Mutator methods
{{ page('en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype', 'Mutator_methods') }}
Accessor methods
{{ page('en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype', 'Accessor_methods') }}
Iteration methods
{{ page('en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype', 'Iteration_methods') }}
Bug 859169 explains it quite well.
So, this is using https://developer.mozilla.org/en-US/docs/Template:DekiScript:Wiki and the "page" function starting in line 116.

In line 117, there is:
> var key = 'kuma:include:' + md5(path.toLowerCase());
So, I guess this is the caching key including the page path.

Then, later, the functionality for getting a specific section is implemented as:
> if (section) { params.push('section='+encodeURIComponent(section)); }

Do we need a specific cache key for each section? Currently it looks like the cache key would be the same when getting different sections on the page as it is same the page path.

Les, could that be an issue?
Flags: needinfo?(lorchard)
(In reply to Florian Scholz [:fscholz] (elchi3) from comment #8)

> Les, could that be an issue?

Hmm, yup, that would probably do it. The cache would have the first thing fetched, and the key would omit the section, so any section request would get the same thing
Flags: needinfo?(lorchard)
So, I tweaked the kumascript method to include section name in the cache key:

https://developer.mozilla.org/en-US/docs/Template:DekiScript:Wiki$compare?to=542141&from=533533

I don't see the issue any more on that page... did this fix it?
(In reply to Les Orchard [:lorchard] from comment #11)
> I don't see the issue any more on that page... did this fix it?

I just tested, and yes, this looks indeed fixed \o/ Thanks!
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.