Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mitm-superset
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Machine Data
mitm-superset
Commits
21ca26ac
Unverified
Commit
21ca26ac
authored
2 months ago
by
Mehmet Salih Yavuz
Committed by
GitHub
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(Row): don't unload charts while embedded to reduce rerenders (#33422)
parent
33e48146
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
superset-frontend/src/dashboard/components/gridComponents/Row.jsx
+5
-1
5 additions, 1 deletion
...-frontend/src/dashboard/components/gridComponents/Row.jsx
superset-frontend/src/dashboard/util/isEmbedded.ts
+26
-0
26 additions, 0 deletions
superset-frontend/src/dashboard/util/isEmbedded.ts
with
31 additions
and
1 deletion
superset-frontend/src/dashboard/components/gridComponents/Row.jsx
+
5
−
1
View file @
21ca26ac
...
@@ -51,6 +51,7 @@ import WithPopoverMenu from 'src/dashboard/components/menu/WithPopoverMenu';
...
@@ -51,6 +51,7 @@ import WithPopoverMenu from 'src/dashboard/components/menu/WithPopoverMenu';
import
{
componentShape
}
from
'
src/dashboard/util/propShapes
'
;
import
{
componentShape
}
from
'
src/dashboard/util/propShapes
'
;
import
backgroundStyleOptions
from
'
src/dashboard/util/backgroundStyleOptions
'
;
import
backgroundStyleOptions
from
'
src/dashboard/util/backgroundStyleOptions
'
;
import
{
BACKGROUND_TRANSPARENT
}
from
'
src/dashboard/util/constants
'
;
import
{
BACKGROUND_TRANSPARENT
}
from
'
src/dashboard/util/constants
'
;
import
{
isEmbedded
}
from
'
src/dashboard/util/isEmbedded
'
;
import
{
EMPTY_CONTAINER_Z_INDEX
}
from
'
src/dashboard/constants
'
;
import
{
EMPTY_CONTAINER_Z_INDEX
}
from
'
src/dashboard/constants
'
;
import
{
isCurrentUserBot
}
from
'
src/utils/isBot
'
;
import
{
isCurrentUserBot
}
from
'
src/utils/isBot
'
;
import
{
useDebouncedEffect
}
from
'
../../../explore/exploreUtils
'
;
import
{
useDebouncedEffect
}
from
'
../../../explore/exploreUtils
'
;
...
@@ -188,8 +189,11 @@ const Row = props => {
...
@@ -188,8 +189,11 @@ const Row = props => {
observerDisabler
=
new
IntersectionObserver
(
observerDisabler
=
new
IntersectionObserver
(
([
entry
])
=>
{
([
entry
])
=>
{
if
(
!
entry
.
isIntersecting
&&
isComponentVisibleRef
.
current
)
{
if
(
!
entry
.
isIntersecting
&&
isComponentVisibleRef
.
current
)
{
// Reference: https://www.w3.org/TR/intersection-observer/#dom-intersectionobserver-rootmargin
if
(
!
isEmbedded
())
{
setIsInView
(
false
);
setIsInView
(
false
);
}
}
}
},
},
{
{
rootMargin
:
'
400% 0px
'
,
rootMargin
:
'
400% 0px
'
,
...
...
This diff is collapsed.
Click to expand it.
superset-frontend/src/dashboard/util/isEmbedded.ts
0 → 100644
+
26
−
0
View file @
21ca26ac
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export
const
isEmbedded
=
()
=>
{
try
{
return
window
.
self
!==
window
.
top
||
window
.
frameElement
!==
null
;
}
catch
(
e
)
{
return
true
;
}
};
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