Skip to content

Commit 3afbf04

Browse files
authored
Merge pull request #324 from fractal-analytics-platform/fix-performance-issue
Fixed argument popovers performance issue
2 parents 9ffa473 + 1d11184 commit 3afbf04

File tree

6 files changed

+43
-20
lines changed

6 files changed

+43
-20
lines changed

.github/workflows/end_to_end_tests.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ jobs:
4242
name: playwright-coverage
4343
path: coverage-playwright/
4444
retention-days: 30
45+
46+
env:
47+
ENABLE_COVERAGE: "true"

.github/workflows/unit_tests.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ jobs:
3333
name: unit-coverage
3434
path: coverage-unit/
3535
retention-days: 30
36+
37+
env:
38+
ENABLE_COVERAGE: "true"

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Unreleased
44

5+
* Fixed argument popovers performance issue (\#324).
56
* Added end to end tests and coverage configuration (\#320).
67

78
# 0.6.1

docs/tests.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ To execute the tests seeing the browser add the `--headed` flag or the `--debug`
2121
Coverage for the unit tests:
2222

2323
```
24-
npx vitest run --coverage.enabled --coverage.provider=istanbul --coverage.include=src --coverage.reporter=json --coverage.all
24+
ENABLE_COVERAGE=true npx vitest run --coverage.enabled --coverage.provider=istanbul --coverage.include=src --coverage.reporter=json --coverage.all
2525
```
2626

2727
Warning: coverage takes some time using the option `--coverage.all`.
2828

29-
Coverage for the playwright tests is automatically collected when running `npx playwright test`.
29+
Coverage for the playwright tests is automatically collected when running `ENABLE_COVERAGE=true npx playwright test`.
3030

3131
To generate a merged html report:
3232

src/lib/components/common/jschema/PropertyDescription.svelte

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,27 @@
33
44
export let description = undefined;
55
6+
let element;
7+
68
onMount(() => {
7-
const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]');
8-
// eslint-disable-next-line no-undef
9-
popoverTriggerList.forEach(popoverEl => new bootstrap.Popover(popoverEl));
9+
if (element) {
10+
// @ts-ignore
11+
// eslint-disable-next-line no-undef
12+
new bootstrap.Popover(element);
13+
}
1014
});
11-
1215
</script>
1316

14-
<span class='ms-2'>
15-
{#if description }
16-
<a tabindex='0' role='button' data-bs-trigger='focus' class='bi bi-info-circle' data-bs-toggle='popover'
17-
data-bs-content={description}></a>
18-
{/if}
19-
</span>
17+
<span class="ms-2 property-description">
18+
{#if description}
19+
<span
20+
bind:this={element}
21+
tabindex="0"
22+
role="button"
23+
data-bs-trigger="focus"
24+
class="bi bi-info-circle text-primary"
25+
data-bs-toggle="popover"
26+
data-bs-content={description}
27+
/>
28+
{/if}
29+
</span>

vite.config.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,34 @@ const packageJsonFile = fileURLToPath(new URL('package.json', import.meta.url));
77
const packageJsonData = readFileSync(packageJsonFile);
88
const pkg = JSON.parse(packageJsonData);
99

10+
const enableIstanbul = process.env['ENABLE_COVERAGE'];
11+
1012
/** @type {import('vite').UserConfig} */
1113
const config = {
1214
plugins: [
1315
sveltekit(),
14-
istanbul({
15-
include: 'src/*',
16-
exclude: ['node_modules', 'tests', 'static'],
17-
extension: ['.js', '.svelte'],
18-
requireEnv: false,
19-
forceBuildInstrument: true
20-
})
16+
enableIstanbul &&
17+
istanbul({
18+
include: 'src/*',
19+
exclude: ['node_modules', 'tests', 'static'],
20+
extension: ['.js', '.svelte'],
21+
requireEnv: false,
22+
forceBuildInstrument: true
23+
})
2124
],
2225
define: {
2326
__APP_VERSION__: JSON.stringify(pkg.version)
2427
},
28+
build: {
29+
sourcemap: true
30+
},
2531
test: {
2632
globals: true,
2733
include: ['**/__tests__/**/*.?(c|m)[jt]s?(x)'],
2834
coverage: {
2935
provider: 'istanbul',
3036
reporter: ['text', 'json', 'html'],
31-
reportsDirectory: './coverage-unit',
37+
reportsDirectory: './coverage-unit'
3238
}
3339
},
3440
optimizeDeps: {

0 commit comments

Comments
 (0)