Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
27378cd1
Commit
27378cd1
authored
9 years ago
by
Tom Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Ensure Angular digest is run when changing location in qb. Resolves #1917
parent
6888364c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/card/card.controllers.js
+15
-8
15 additions, 8 deletions
frontend/src/card/card.controllers.js
with
15 additions
and
8 deletions
frontend/src/card/card.controllers.js
+
15
−
8
View file @
27378cd1
...
...
@@ -878,8 +878,7 @@ CardControllers.controller('CardDetail', [
setDatabase
(
sampleDataset
.
id
);
}
// needs to be performed asynchronously otherwise we get weird infinite recursion
var
updateUrl
=
(
replaceState
)
=>
setTimeout
(
function
()
{
function
updateUrl
(
replaceState
)
{
// don't update the URL if we're currently showing the tutorial
if
(
isShowingTutorial
)
{
return
;
...
...
@@ -901,12 +900,20 @@ CardControllers.controller('CardDetail', [
// if the serialized card is identical replace the previous state instead of adding a new one
// e.x. when saving a new card we want to replace the state and URL with one with the new card ID
replaceState
=
replaceState
||
(
window
.
history
.
state
&&
window
.
history
.
state
.
serializedCard
===
newState
.
serializedCard
);
if
(
replaceState
)
{
window
.
history
.
replaceState
(
newState
,
null
,
url
);
}
else
{
window
.
history
.
pushState
(
newState
,
null
,
url
);
}
},
0
);
// ensure the digest cycle is run, otherwise pending location changes will prevent navigation away from query builder on the first click
$scope
.
$apply
(()
=>
{
// prevents infinite digest loop
// https://stackoverflow.com/questions/22914228/successfully-call-history-pushstate-from-angular-without-inifinite-digest
$location
.
url
(
url
);
$location
.
replace
();
if
(
replaceState
)
{
window
.
history
.
replaceState
(
newState
,
null
,
$location
.
absUrl
());
}
else
{
window
.
history
.
pushState
(
newState
,
null
,
$location
.
absUrl
());
}
});
}
function
popStateListener
(
e
)
{
if
(
e
.
state
&&
e
.
state
.
card
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment