Skip to content

Commit

Permalink
Bust browser cache for JS and CSS assets
Browse files Browse the repository at this point in the history
Some users have reported a  error when modifying menus, as their JS files were still cached, therefore they were sending full arrays back to the controller. This fix should encourage their browsers to download the latest JS files.

Refs: https://github.com/rainlab/pages-plugin/commit/fc99d037f075e4093c2fc640862e7ce122ad32de\#r39741923
  • Loading branch information
Ben Thomson committed Jun 9, 2020
1 parent a1210a4 commit 3b6c5a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions controllers/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ public function __construct()
public function index()
{
$this->addJs('/modules/backend/assets/js/october.treeview.js', 'core');
$this->addJs('/plugins/rainlab/pages/assets/js/pages-page.js');
$this->addJs('/plugins/rainlab/pages/assets/js/pages-snippets.js');
$this->addCss('/plugins/rainlab/pages/assets/css/pages.css');
$this->addJs('/plugins/rainlab/pages/assets/js/pages-page.js', 'RainLab.Pages');
$this->addJs('/plugins/rainlab/pages/assets/js/pages-snippets.js', 'RainLab.Pages');
$this->addCss('/plugins/rainlab/pages/assets/css/pages.css', 'RainLab.Pages');

// Preload the code editor class as it could be needed
// before it loads dynamically.
Expand Down
6 changes: 3 additions & 3 deletions formwidgets/MenuItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class MenuItems extends FormWidgetBase
public $urlRequiredMessage = 'rainlab.pages::lang.menuitem.url_required';

public $cmsPageRequiredMessage = 'rainlab.pages::lang.menuitem.cms_page_required';

public $newItemTitle = 'rainlab.pages::lang.menuitem.new_item';

/**
Expand Down Expand Up @@ -80,7 +80,7 @@ public function prepareVars()
*/
protected function loadAssets()
{
$this->addJs('js/menu-items-editor.js', 'core');
$this->addJs('js/menu-items-editor.js', 'RainLab.Pages');
}

/**
Expand All @@ -98,7 +98,7 @@ public function getSaveValue($value)
/**
* Returns the item reference description.
* @param \RainLab\Pages\Classes\MenuItem $item Specifies the menu item
* @return string
* @return string
*/
protected function getReferenceDescription($item)
{
Expand Down
3 changes: 2 additions & 1 deletion updates/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@
1.3.1: Added ChildPages Component, prevent hidden pages from being returned via menu item resolver.
1.3.2: Fixes error when creating a subpage whose parent has no layout set.
1.3.3: Improves user experience for users with only partial access through permissions
1.3.4: Fix error where large menus were being truncated due to the PHP "max_input_vars" configuration value. Improved Slovenian translation.
1.3.4: Fix error where large menus were being truncated due to the PHP "max_input_vars" configuration value. Improved Slovenian translation.
1.3.5: Minor fix to bust the browser cache for JS assets. Prevent duplicate property fields in snippet inspector.

2 comments on commit 3b6c5a7

@mjauvin
Copy link
Contributor

@mjauvin mjauvin commented on 3b6c5a7 Jun 9, 2020

Choose a reason for hiding this comment

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

@bennothommo that would be why I still got the cached version after upgrading.

Thanks for fixing this.

@bennothommo
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No worries @mjauvin

Please sign in to comment.