Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dotcom-rendering/src/components/Island.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ describe('Island: server-side rendering', () => {
enhanceTweetsSwitch={false}
onFirstPage={true}
webURL=""
renderingTarget="Web"
mostRecentBlockId=""
hasPinnedPost={false}
/>,
Expand Down
13 changes: 11 additions & 2 deletions dotcom-rendering/src/components/Liveness.importable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { getEmotionCache } from '../client/islands/emotion';
import { initHydration } from '../client/islands/initHydration';
import { useApi } from '../lib/useApi';
import type { LiveUpdateType } from '../types/liveBlog';
import type { RenderingTarget } from '../types/renderingTarget';
import { Toast } from './Toast';

type Props = {
Expand All @@ -17,6 +18,7 @@ type Props = {
webURL: string;
mostRecentBlockId: string;
hasPinnedPost: boolean;
renderingTarget: RenderingTarget;
};

/**
Expand Down Expand Up @@ -154,6 +156,7 @@ export const Liveness = ({
webURL,
mostRecentBlockId,
hasPinnedPost,
renderingTarget,
}: Props) => {
const [showToast, setShowToast] = useState(false);
const [topOfBlogVisible, setTopOfBlogVisible] = useState<boolean>();
Expand Down Expand Up @@ -309,9 +312,15 @@ export const Liveness = ({
revealPendingBlocks();
setNumHiddenBlocks(0);
} else {
window.location.href = `${webURL}#${placeToScrollTo}`;
const url = new URL(webURL);
if (renderingTarget === 'Apps') {
url.searchParams.set('dcr', 'apps');
}
url.hash = placeToScrollTo;

window.location.href = url.href;
}
}, [hasPinnedPost, onFirstPage, webURL]);
}, [hasPinnedPost, onFirstPage, webURL, renderingTarget]);

if (toastRoot && showToast) {
/**
Expand Down
1 change: 1 addition & 0 deletions dotcom-rendering/src/layouts/LiveLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ export const LiveLayout = (props: WebProps | AppsProps) => {
}
onFirstPage={pagination.currentPage === 1}
webURL={article.webURL}
renderingTarget={renderingTarget}
// We default to string here because the property is optional but we
// know it will exist for all blogs
mostRecentBlockId={
Expand Down
Loading