Skip to content

Commit f426e86

Browse files
committed
remove empty lines
1 parent a1d8f1a commit f426e86

File tree

2 files changed

+42
-4
lines changed

2 files changed

+42
-4
lines changed

docs/platforms/javascript/guides/react/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ Sentry.init({
8989
// Enable logs to be sent to Sentry
9090
enableLogs: true,
9191
// ___PRODUCT_OPTION_END___ logs
92-
9392
// ___PRODUCT_OPTION_START___ performance
93+
9494
// Set tracesSampleRate to 1.0 to capture 100%
9595
// of transactions for tracing.
9696
// Learn more at

src/components/onboarding/index.tsx

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,15 +253,15 @@ export function updateElementsVisibilityForOptions(
253253

254254
if (closeIndex === -1) return;
255255

256-
// Check if any lines between open and close are visible option lines
256+
// Check if any lines between open and close are visible (non-marker lines)
257257
let hasVisibleIntegrations = false;
258258
for (let i = openIndex + 1; i < closeIndex; i++) {
259259
const line = allLines[i];
260-
const isOption = line.dataset.onboardingOption;
261260
const isHidden = line.classList.contains('hidden');
262261
const isMarker = line.dataset.onboardingOptionHidden;
263262

264-
if (isOption && !isMarker && !isHidden) {
263+
// Count any visible non-marker line
264+
if (!isMarker && !isHidden) {
265265
hasVisibleIntegrations = true;
266266
break;
267267
}
@@ -270,6 +270,44 @@ export function updateElementsVisibilityForOptions(
270270
// Toggle visibility of both open and close lines
271271
openLine.classList.toggle('hidden', !hasVisibleIntegrations);
272272
allLines[closeIndex].classList.toggle('hidden', !hasVisibleIntegrations);
273+
274+
// Hide empty lines adjacent to the wrapper when no integrations are visible
275+
if (!hasVisibleIntegrations) {
276+
// Check line before open wrapper
277+
if (openIndex > 0) {
278+
const prevLine = allLines[openIndex - 1];
279+
const prevText = prevLine.textContent?.trim();
280+
if (!prevText || prevText === '') {
281+
prevLine.style.display = 'none';
282+
}
283+
}
284+
285+
// Check line after close wrapper
286+
if (closeIndex < allLines.length - 1) {
287+
const nextLine = allLines[closeIndex + 1];
288+
const nextText = nextLine.textContent?.trim();
289+
if (!nextText || nextText === '') {
290+
nextLine.style.display = 'none';
291+
}
292+
}
293+
} else {
294+
// Show empty lines when integrations are visible
295+
if (openIndex > 0) {
296+
const prevLine = allLines[openIndex - 1];
297+
const prevText = prevLine.textContent?.trim();
298+
if (!prevText || prevText === '') {
299+
prevLine.style.display = '';
300+
}
301+
}
302+
303+
if (closeIndex < allLines.length - 1) {
304+
const nextLine = allLines[closeIndex + 1];
305+
const nextText = nextLine.textContent?.trim();
306+
if (!nextText || nextText === '') {
307+
nextLine.style.display = '';
308+
}
309+
}
310+
}
273311
});
274312
}
275313

0 commit comments

Comments
 (0)