Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Agenda - Overview of LINE NEWS - Front-end problems LINE NEWS faces - Implementation of the skeleton screen - Two problems in our own skeleton screen - What changed and future challenges

Slide 3

Slide 3 text

Agenda - Overview of LINE NEWS - Front-end problems LINE NEWS faces - Implementation of the skeleton screen - Two problems in our own skeleton screen - What changed and future challenges

Slide 4

Slide 4 text

LINE NEWS - MAU: 77 million - MPV: 15.4 billion - A large scale of development - Web front-end development

Slide 5

Slide 5 text

- Technology - TypeScript - React NEWS Tab - Features - Pages are arranged in tabs - Multiple gateways to articles

Slide 6

Slide 6 text

Agenda - Overview of LINE NEWS - Front-end problems LINE NEWS faces - Implementation of the skeleton screen - Two problems in our own skeleton screen - What changed and future challenges

Slide 7

Slide 7 text

Layout Shift

Slide 8

Slide 8 text

Layout Shift

Slide 9

Slide 9 text

APIs causing the problem

Slide 10

Slide 10 text

NEWS Tab APIs Personalization A/B Testing Advertisements

Slide 11

Slide 11 text

Personalization API Features Affects every user Response time is slow Cannot use CDN cache Articles related to cars

Slide 12

Slide 12 text

A/B Testing API Features Expose different UIs for sets of users Release features gradually to users User A User B

Slide 13

Slide 13 text

Advertisements API Features Personalized Manage inventory

Slide 14

Slide 14 text

NEWS Tab APIs Personalization A/B Testing Advertisements

Slide 15

Slide 15 text

Adaptation of skeleton screens ? ? ?

Slide 16

Slide 16 text

Skeleton screens behavior

Slide 17

Slide 17 text

NEWS Tab APIs Personalization A/B Testing Advertisements

Slide 18

Slide 18 text

Our own skeleton screens

Slide 19

Slide 19 text

It's just one skeleton screen

Slide 20

Slide 20 text

It's just one skeleton screen

Slide 21

Slide 21 text

It's just one skeleton screen

Slide 22

Slide 22 text

It's just one skeleton screen

Slide 23

Slide 23 text

- Wait for all APIs to be executed ︙ Conditions in which the skeleton screen disappears

Slide 24

Slide 24 text

- Wait for all APIs to be executed Not ideal ︙ Conditions in which the skeleton screen disappears

Slide 25

Slide 25 text

Not ideal - Wait for some APIs - Wait for all APIs to be executed ︙ Conditions in which the skeleton screen disappears

Slide 26

Slide 26 text

Not ideal - Wait for some APIs - Wait for all APIs to be executed ︙ Not ideal Conditions in which the skeleton screen disappears

Slide 27

Slide 27 text

Fixed Fixed Fixed Minimum conditions

Slide 28

Slide 28 text

Minimum conditions

Slide 29

Slide 29 text

Target Target Target Non-target In viewport Minimum conditions

Slide 30

Slide 30 text

Target Target Target User don't care if a layout shift occurs In viewport Minimum conditions

Slide 31

Slide 31 text

Conditions in which the skeleton screen disappears ≒ APIs

Slide 32

Slide 32 text

APIs + Heights of contents Conditions in which the skeleton screen disappears =

Slide 33

Slide 33 text

Front-end problems LINE NEWS faces - The adaptation of skeleton screens - The problem: the layout shift

Slide 34

Slide 34 text

Agenda - Overview of LINE NEWS - Front-end problems LINE NEWS faces - Implementation of the skeleton screen - Two problems in our own skeleton screen - What changed and future challenges

Slide 35

Slide 35 text

Agenda - Overview of LINE NEWS - Front-end problems LINE NEWS faces - Implementation of the skeleton screen - Front-end architecture of NEWS Tab - Skeleton screen components - Two heights required to hide the skeleton screen - How and when the content height is determined - Utilities - Two problems in our own skeleton screen - What changed and future challenges

Slide 36

Slide 36 text

Agenda - Overview of LINE NEWS - Front-end problems LINE NEWS faces - Implementation of the skeleton screen - Front-end architecture of NEWS Tab - Skeleton screen components - Two heights required to hide the skeleton screen - How and when the content height is determined - Utilities - Two problems in our own skeleton screen - What changed and future challenges

Slide 37

Slide 37 text

Front-end architecture of NEWS Tab APIs Stores ︙ Actions

Slide 38

Slide 38 text

APIs Stores Actions ︙ Front-end architecture of NEWS Tab

Slide 39

Slide 39 text

APIs Stores Actions ︙ Front-end architecture of NEWS Tab

Slide 40

Slide 40 text

APIs Actions ︙ Stores Front-end architecture of NEWS Tab

Slide 41

Slide 41 text

︙ Front-end architecture of NEWS Tab Stores Actions APIs

Slide 42

Slide 42 text

Front-end architecture of NEWS Tab APIs Stores ︙ Actions

Slide 43

Slide 43 text

Agenda - Overview of LINE NEWS - Front-end problems LINE NEWS faces - Implementation of the skeleton screen - Front-end architecture of NEWS Tab - Skeleton screen components - Two heights required to hide the skeleton screen - How and when the content height is determined - Utilities - Two problems in our own skeleton screen - What changed and future challenges

Slide 44

Slide 44 text

Agenda - Overview of LINE NEWS - Front-end problems LINE NEWS faces - Implementation of the skeleton screen - Front-end architecture of NEWS Tab - Skeleton screen components - Two heights required to hide the skeleton screen - How and when the content height is determined - Utilities - Two problems in our own skeleton screen - What changed and future challenges

Slide 45

Slide 45 text

Apply skeleton screen components APIs Stores Actions ︙

Slide 46

Slide 46 text

APIs Stores Actions ︙ Apply skeleton screen components

Slide 47

Slide 47 text

- A component with only style applied - Does not contain business logic - Switch the display of skeleton screen component - Manage fade-out animation Two components used to create the skeleton screen

Slide 48

Slide 48 text

- Switch the display of skeleton screen component - Manage fade-out animation The SkeletonScreen component: 1/2 - A component with only style applied - Does not contain business logic

Slide 49

Slide 49 text

export const SkeletonScreen = (props: Props) => { return (
...
... ); }; The SkeletonScreen component: 1/2

Slide 50

Slide 50 text

The SkeletonOverlap component: 2/2 - A component with only style applied - Does not contain business logic - Switch the display of skeleton screen component - Manage fade-out animation

Slide 51

Slide 51 text

export const SkeletonOverlap = props => { const [state, done] = useAnimationSkeletonOverlap(props.readyToHide); return (
{state !== ANIMATION_DONE && ( )} {props.children}
); }; The SkeletonOverlap component: 2/2

Slide 52

Slide 52 text

export const SkeletonOverlap = props => { const [state, done] = useAnimationSkeletonOverlap(props.readyToHide); return (
{state !== ANIMATION_DONE && ( )} {props.children}
); }; The SkeletonOverlap component: 2/2

Slide 53

Slide 53 text

export const SkeletonOverlap = props => { const [state, done] = useAnimationSkeletonOverlap(props.readyToHide); return (
{state !== ANIMATION_DONE && ( )} {props.children}
); }; The SkeletonOverlap component: 2/2

Slide 54

Slide 54 text

export const SkeletonOverlap = props => { const [state, done] = useAnimationSkeletonOverlap(props.readyToHide); return (
{state !== ANIMATION_DONE && ( )} {props.children}
); }; The SkeletonOverlap component: 2/2

Slide 55

Slide 55 text

Agenda - Overview of LINE NEWS - Front-end problems LINE NEWS faces - Implementation of the skeleton screen - Front-end architecture of NEWS Tab - Skeleton screen components - Two heights required to hide the skeleton screen - How and when the content height is determined - Utilities - Two problems in our own skeleton screen - What changed and future challenges

Slide 56

Slide 56 text

Conditions in which the skeleton screen disappears

Slide 57

Slide 57 text

(1) The height of viewport (The skeleton screen) (2) The total height of fixed contents If (2) is greater than (1), the skeleton screen disappears Conditions in which the skeleton screen disappears

Slide 58

Slide 58 text

Manage the display of skeleton screens APIs Actions ︙ Stores

Slide 59

Slide 59 text

The skeleton screen store export interface SkeletonOverlapState { screenHeight: number; tabs: SkeletonOverlapTab[]; } Stores

Slide 60

Slide 60 text

The skeleton screen store export interface SkeletonOverlapState { screenHeight: number; tabs: SkeletonOverlapTab[]; }

Slide 61

Slide 61 text

export interface SkeletonOverlapTab { [index: number]: { elementHeight: number; }; totalElementHeight: number; readyToHide: boolean; } export interface SkeletonOverlapState { screenHeight: number; tabs: SkeletonOverlapTab[]; } new ResizeObserver(() => { setScreenSize(document.documentElement.clientHeight); }); The skeleton screen store

Slide 62

Slide 62 text

export interface SkeletonOverlapState { screenHeight: number; tabs: SkeletonOverlapTab[]; } export interface SkeletonOverlapTab { [index: number]: { elementHeight: number; }; totalElementHeight: number; readyToHide: boolean; } The skeleton screen store

Slide 63

Slide 63 text

export interface SkeletonOverlapTab { [index: number]: { elementHeight: number; }; totalElementHeight: number; readyToHide: boolean; } export interface SkeletonOverlapState { screenHeight: number; tabs: SkeletonOverlapTab[]; } The skeleton screen store

Slide 64

Slide 64 text

export interface SkeletonOverlapState { screenHeight: number; tabs: SkeletonOverlapTab[]; } export interface SkeletonOverlapTab { [index: number]: { elementHeight: number; }; totalElementHeight: number; readyToHide: boolean; } The skeleton screen store

Slide 65

Slide 65 text

export interface SkeletonOverlapState { screenHeight: number; tabs: SkeletonOverlapTab[]; } export interface SkeletonOverlapTab { [index: number]: { elementHeight: number; }; totalElementHeight: number; readyToHide: boolean; } The skeleton screen store

Slide 66

Slide 66 text

export interface SkeletonOverlapState { screenHeight: number; tabs: SkeletonOverlapTab[]; } export interface SkeletonOverlapTab { [index: number]: { elementHeight: number; }; totalElementHeight: number; readyToHide: boolean; } The skeleton screen store

Slide 67

Slide 67 text

Manage the display of skeleton screens APIs Actions ︙ Stores

Slide 68

Slide 68 text

Agenda - Overview of LINE NEWS - The layout shift problem and the adaptation of skeleton screens - Implementation of the skeleton screen - Front-end architecture of NEWS Tab - Skeleton screen components - Two heights required to hide the skeleton screen - How and when the content height is determined - Utilities - Two problems in our own skeleton screen - What changed and future challenges

Slide 69

Slide 69 text

Fixed Fixed Fixed Content Store Content Store Content Store API API API Data status Data status Data status How and when the content height is determined

Slide 70

Slide 70 text

Data status Success Pending None The data doesn't exist yet Data is available Not ready to render Not ready to render Ready to render In the process of retrieving data

Slide 71

Slide 71 text

Data status Whether the content can be rendered None Pending Success 㾎 Failed 㾎 Cached 㾎 Cached & Pending 㾎

Slide 72

Slide 72 text

Data status Stores Actions (Dispatcher) APIs getArticles() { return API.fetchArticles(), .then((articles) => { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLES, articles, }); }); }

Slide 73

Slide 73 text

Data status Stores Actions (Dispatcher) APIs getArticles() { return API.fetchArticles(), .then((articles) => { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLES, articles, }); }); }

Slide 74

Slide 74 text

APIs Data status Stores Actions (Dispatcher) getArticles() { return API.fetchArticles(), .then((articles) => { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLES, articles, }); }); }

Slide 75

Slide 75 text

Data status getArticles() { return API.fetchArticles(), .then((articles) => { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLES, articles, }); }); } getArticles() { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLE_PENDING, }); return API.fetchArticles(), .then((articles) => { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLES_SUCCESS, articles, }); }) .catch(() => { dispatcher.dispatch ({ type: ACTION_TYPE_GET_ARTICLES_FAILED, }); }); }

Slide 76

Slide 76 text

Data status None Data status flows getArticles() { return API.fetchArticles(), .then((articles) => { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLES, articles, }); }); } getArticles() { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLE_PENDING, }); return API.fetchArticles(), .then((articles) => { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLES_SUCCESS, articles, }); }) .catch(() => { dispatcher.dispatch ({ type: ACTION_TYPE_GET_ARTICLES_FAILED, }); }); }

Slide 77

Slide 77 text

getArticles() { return API.fetchArticles(), .then((articles) => { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLES, articles, }); }); } getArticles() { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLE_PENDING, }); return API.fetchArticles(), .then((articles) => { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLES_SUCCESS, articles, }); }) .catch(() => { dispatcher.dispatch ({ type: ACTION_TYPE_GET_ARTICLES_FAILED, }); }); } Data status None Pending Data status flows

Slide 78

Slide 78 text

Data status None Data status flows Success Pending getArticles() { return API.fetchArticles(), .then((articles) => { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLES, articles, }); }); } getArticles() { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLE_PENDING, }); return API.fetchArticles(), .then((articles) => { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLES_SUCCESS, articles, }); }) .catch(() => { dispatcher.dispatch ({ type: ACTION_TYPE_GET_ARTICLES_FAILED, }); }); }

Slide 79

Slide 79 text

Data status getArticles() { return API.fetchArticles(), .then((articles) => { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLES, articles, }); }); } getArticles() { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLE_PENDING, }); return API.fetchArticles(), .then((articles) => { dispatcher.dispatch({ type: ACTION_TYPE_GET_ARTICLES_SUCCESS, articles, }); }) .catch(() => { dispatcher.dispatch ({ type: ACTION_TYPE_GET_ARTICLES_FAILED, }); }); } None Success Failed Data status flows Pending

Slide 80

Slide 80 text

Dependencies on multiple data status Fixed Fixed Fixed Content Store Content Store Content Store Data status Data status Data status

Slide 81

Slide 81 text

Fixed Fixed Content Store Content Store Content Store Data status Data status Content Store Data status Fixed Dependencies on multiple data status

Slide 82

Slide 82 text

Data A Data B Data C Dependencies on multiple data status

Slide 83

Slide 83 text

Data A Data B Data C AND AND = Dependencies on multiple data status

Slide 84

Slide 84 text

Data A Data B Data C AND AND = Success Cached Pending Not Ready Dependencies on multiple data status

Slide 85

Slide 85 text

Data A Data B Data C AND AND = Success Cached Failed Ready Dependencies on multiple data status

Slide 86

Slide 86 text

Fixed Fixed Fixed Content Store Content Store Content Store Data status Data status Content Store Data status Store parameters to determine when each skeleton screen disappears

Slide 87

Slide 87 text

Content Store Content Store Content Store Data status Data status Content Store SkeletonScreen Store Data status Height Height Height Store parameters to determine when each skeleton screen disappears

Slide 88

Slide 88 text

SkeletonScreen Store Height, Index Height, Index Height, Index Content Store Content Store Content Store Data status Data status Content Store Data status Store parameters to determine when each skeleton screen disappears

Slide 89

Slide 89 text

Content A Content B Content C Not just the total height but the order matters, too

Slide 90

Slide 90 text

Ready Ready Not Ready Content A Content B Content C Not just the total height but the order matters, too

Slide 91

Slide 91 text

Content A Content C + > = Height of viewport Should we hide the skeleton in this case? Not just the total height but the order matters, too

Slide 92

Slide 92 text

Ready Ready Not Ready Ready Ready Ready Content A Content B Content C Content A Content B Content C Not just the total height but the order matters, too

Slide 93

Slide 93 text

Ready Ready Not Ready Content A Content B Content C Not just the total height but the order matters, too

Slide 94

Slide 94 text

Ready Ready Not Ready Content A Content B Content C Content A Content B Content C Ready Ready Not Ready Not just the total height but the order matters, too

Slide 95

Slide 95 text

Ready Ready Not Ready Content A Content B Content C Content A Content B Content C Ready Ready Not Ready Not just the total height but the order matters, too

Slide 96

Slide 96 text

SkeletonScreen Store Height, Index Height, Index Height, Index Content Store Content Store Content Store Data status Data status Content Store Data status Store parameters to determine when each skeleton screen disappears

Slide 97

Slide 97 text

Agenda - Overview of LINE NEWS - Front-end problems LINE NEWS faces - Implementation of the skeleton screen - Front-end architecture of NEWS Tab - Skeleton screen components - Two height to disappear the skeleton screen - How and when the content height is determined - Utilities - Two problems in our own skeleton screen - What changed and future challenges

Slide 98

Slide 98 text

Utilities For hooks export function useRenderReady({ dataStatus, onRenderReady, }) { … } For class components export function RenderReadyWrapper({ dataStatus, onRenderReady, childrenCallback, }: RenderReadyWrapperProps) { const rootRef = useRenderReady({ … }); return childrenCallback(rootRef); }

Slide 99

Slide 99 text

Utilities For hooks export function useRenderReady({ dataStatus, onRenderReady, }: UseRenderReadyParams) { const rootRef = useRef(null); … return rootRef; }

Slide 100

Slide 100 text

Utilities Usage const Content = (props) => { const ref = useRenderReady({ onRenderReady: (elementHeight) => { readyContent( props.tabIndex, props.contentIndex, props.elementHeight ); }, dataStatus: [props.dataStatus1, props.dataStatus2], }); return
; }

Slide 101

Slide 101 text

Utilities Usage const Content = (props) => { const ref = useRenderReady({ onRenderReady: (elementHeight) => { readyContent( props.tabIndex, props.contentIndex, props.elementHeight ); }, dataStatus: [props.dataStatus1, props.dataStatus2], }); return
; } useRenderReady

Slide 102

Slide 102 text

Utilities Usage const Content = (props) => { const ref = useRenderReady({ onRenderReady: (elementHeight) => { readyContent( props.tabIndex, props.contentIndex, props.elementHeight ); }, dataStatus: [props.dataStatus1, props.dataStatus2], }); return
; } useRenderReady Data status ︙ Data status

Slide 103

Slide 103 text

Utilities Usage const Content = (props) => { const ref = useRenderReady({ onRenderReady: (elementHeight) => { readyContent( props.tabIndex, props.contentIndex, props.elementHeight ); }, dataStatus: [props.dataStatus1, props.dataStatus2], }); return
; }

Slide 104

Slide 104 text

Utilities Usage const Content = (props) => { const ref = useRenderReady({ onRenderReady: (elementHeight) => { readyContent( props.tabIndex, props.contentIndex, props.elementHeight ); }, dataStatus: [props.dataStatus1, props.dataStatus2], }); return
; }

Slide 105

Slide 105 text

Usage const Content = (props) => { const ref = useRenderReady({ onRenderReady: (elementHeight) => { readyContent( props.tabIndex, props.contentIndex, props.elementHeight ); }, dataStatus: [props.dataStatus1, props.dataStatus2], }); return
; } Utilities

Slide 106

Slide 106 text

Utilities Usage const Content = (props) => { const ref = useRenderReady({ onRenderReady: (elementHeight) => { readyContent( props.tabIndex, props.contentIndex, props.elementHeight ); }, dataStatus: [props.dataStatus1, props.dataStatus2], }); return
; }

Slide 107

Slide 107 text

Agenda - Overview of LINE NEWS - Front-end problems LINE NEWS faces - Implementation of the skeleton screen - Two problems in our own skeleton screen - What changed and future challenges

Slide 108

Slide 108 text

Comparisons in skeleton screen methods Our own skeleton screen Ideal skeleton screen

Slide 109

Slide 109 text

Our own skeleton screen Broken Ideal skeleton screen Comparisons in skeleton screen methods

Slide 110

Slide 110 text

Ideal skeleton screen Broken Broken Our own skeleton screen Comparisons in skeleton screen methods

Slide 111

Slide 111 text

Two problems in our own skeleton screen Skeleton screens not disappearing Hard to detect where the problem is occurring

Slide 112

Slide 112 text

Set a timeout for displaying the skeleton screen The solutions Skeleton screens not disappearing Hard to detect where the problem is occurring

Slide 113

Slide 113 text

Provide a dedicated debugging mechanism Set a timeout for displaying the skeleton screen Skeleton screens not disappearing Hard to detect where the problem is occurring The solutions

Slide 114

Slide 114 text

Debug tools

Slide 115

Slide 115 text

A debugger for the skeleton screen - Enable or disabled - Select a tab - The height of viewport - The height of contents - Ready or not status for contents - The index of contents - Targeted contents for the skeleton screen disappearing - Number of consecutive contents

Slide 116

Slide 116 text

- Enable or disabled - Select a tab - The height of viewport - The height of contents - Ready or not status for contents… ① - The index of contents - Targeted contents for the skeleton screen disappearing… ② - Number of consecutive contents A debugger for the skeleton screen ① Ready or not

Slide 117

Slide 117 text

① Ready or not - Enable or disabled - Select a tab - The height of viewport - The height of contents - Ready or not status for contents… ① - The index of contents - Targeted contents for the skeleton screen disappearing… ② - Number of consecutive contents A debugger for the skeleton screen Highlighted in red ②

Slide 118

Slide 118 text

Agenda - Overview of LINE NEWS - Front-end problems LINE NEWS faces - Implementation of the skeleton screen - Two problems in our own skeleton screen - What changed and future challenges

Slide 119

Slide 119 text

Cumulative Layout Shift (CLS) 0.348 0.002 “To provide a good user experience, sites should strive to have a CLS score of 0.1 or less.” https://web.dev/i18n/en/cls/

Slide 120

Slide 120 text

Future challenges

Slide 121

Slide 121 text

0.5s 0.2s 2.5s 2.5s The most delayed content determines the time needed

Slide 122

Slide 122 text

A hybrid between our own skeleton screen and an ideal one

Slide 123

Slide 123 text

0.5s 0.2s 2.5s 0.5s Remove specific content from the conditions

Slide 124

Slide 124 text

Thank you