Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
ff26449363de
Commit
1b3a2623
authored
Oct 02, 2018
by
Johann Hubert Sonntagbauer
Committed by
Phil Hughes
Oct 02, 2018
Browse files
circumvent browser cache on browser back navigation
parent
a20e3a68b341
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/assets/javascripts/boards/index.js
View file @
ff264493
...
...
@@ -25,6 +25,7 @@ import './components/board_sidebar';
import
'
./components/new_list_dropdown
'
;
import
BoardAddIssuesModal
from
'
./components/modal/index.vue
'
;
import
'
~/vue_shared/vue_resource_interceptor
'
;
import
{
NavigationType
}
from
'
~/lib/utils/common_utils
'
;
export
default
()
=>
{
const
$boardApp
=
document
.
getElementById
(
'
board-app
'
);
...
...
@@ -32,6 +33,16 @@ export default () => {
window
.
gl
=
window
.
gl
||
{};
// check for browser back and trigger a hard reload to circumvent browser caching.
window
.
addEventListener
(
'
pageshow
'
,
(
event
)
=>
{
const
isNavTypeBackForward
=
window
.
performance
&&
window
.
performance
.
navigation
.
type
===
NavigationType
.
TYPE_BACK_FORWARD
;
if
(
event
.
persisted
||
isNavTypeBackForward
)
{
window
.
location
.
reload
();
}
});
if
(
gl
.
IssueBoardsApp
)
{
gl
.
IssueBoardsApp
.
$destroy
(
true
);
}
...
...
app/assets/javascripts/lib/utils/common_utils.js
View file @
ff264493
...
...
@@ -616,6 +616,17 @@ export const roundOffFloat = (number, precision = 0) => {
return
Math
.
round
(
number
*
multiplier
)
/
multiplier
;
};
/**
* Represents navigation type constants of the Performance Navigation API.
* Detailed explanation see https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigation.
*/
export
const
NavigationType
=
{
TYPE_NAVIGATE
:
0
,
TYPE_RELOAD
:
1
,
TYPE_BACK_FORWARD
:
2
,
TYPE_RESERVED
:
255
,
};
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
utils
=
{
...(
window
.
gl
.
utils
||
{}),
...
...
changelogs/unreleased/-50928-stale-list-of-issues-on-board-after-click-back.yml
0 → 100644
View file @
ff264493
---
title
:
Fix stale issue boards after browser back
merge_request
:
22006
author
:
Johann Hubert Sonntagbauer
type
:
fixed
spec/features/boards/reload_boards_on_browser_back_spec.rb
0 → 100644
View file @
ff264493
require
'rails_helper'
describe
'Ensure Boards do not show stale data on browser back'
,
:js
do
let
(
:project
)
{
create
(
:project
,
:public
)}
let
(
:board
)
{
create
(
:board
,
project:
project
)}
let
(
:user
)
{
create
(
:user
)}
context
'authorized user'
do
before
do
project
.
add_maintainer
(
user
)
sign_in
(
user
)
visit
project_board_path
(
project
,
board
)
wait_for_requests
page
.
within
(
first
(
'.board .issue-count-badge-count'
))
do
expect
(
page
).
to
have_content
(
'0'
)
end
end
it
'created issue is listed on board'
do
visit
new_project_issue_path
(
project
)
wait_for_requests
fill_in
'issue_title'
,
with:
'issue should be shown'
click_button
'Submit issue'
page
.
go_back
wait_for_requests
page
.
go_back
wait_for_requests
page
.
within
(
first
(
'.board .issue-count-badge-count'
))
do
expect
(
page
).
to
have_content
(
'1'
)
end
page
.
within
(
first
(
'.board-card'
))
do
issue
=
project
.
issues
.
find_by_title
(
'issue should be shown'
)
expect
(
page
).
to
have_content
(
issue
.
to_reference
)
expect
(
page
).
to
have_link
(
issue
.
title
,
href:
issue_path
(
issue
))
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment