Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Vueで学ぶデータ構造入門 リンクリストとキューでリアクティビティを捉える / Vue Dat...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
konkarin
November 11, 2025
Programming
690
1
Share
Vueで学ぶデータ構造入門 リンクリストとキューでリアクティビティを捉える / Vue Data Structures: Linked Lists and Queues for Reactivity
Vue Fes Japan 2025 After Talk
https://yappli.connpass.com/event/368396/
konkarin
November 11, 2025
More Decks by konkarin
See All by konkarin
Radix UIとArk UIを併用したマルチフレームワーク対応デザインシステムの道はあるか / multi-framework-designsystem-with-arkui-and-radixui
konkarin
2
1.1k
普通のエンジニアが頑張って30万行のNuxt3移行した話 / Vue Fes Japan 2024 Nuxt3 version up
konkarin
4
5k
30万行を超えるCMSのNuxt3移行戦略 / Yappli tech conference 2023 Frontend
konkarin
0
72
Other Decks in Programming
See All in Programming
KagglerがMixSeekを触ってみた
morim
0
370
How Swift's Type System Guides AI Agents
koher
0
160
AWS re:Invent 2025の少し振り返り + DevOps AgentとBacklogを連携させてみた
satoshi256kbyte
2
150
おれのAgentic Coding 2026/03
tsukasagr
1
140
Running Swift without an OS
kishikawakatsumi
0
350
存在論的プログラミング: 時間と存在を記述する
koriym
5
820
Redox OS でのネームスペース管理と chroot の実現
isanethen
0
550
PCOVから学ぶコードカバレッジ #phpcon_odawara
o0h
PRO
0
230
Rethinking API Platform Filters
vinceamstoutz
0
11k
2026-03-27 #terminalnight 変数展開とコマンド展開でターミナル作業をスマートにする方法
masasuzu
0
300
Swift Concurrency Type System
inamiy
0
320
仕様漏れ実装漏れをなくすトレーサビリティAI基盤のご紹介
orgachem
PRO
8
5k
Featured
See All Featured
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
64
53k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
120
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
210
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
96
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
110
The Spectacular Lies of Maps
axbom
PRO
1
680
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
210
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
220
Testing 201, or: Great Expectations
jmmastey
46
8.1k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
110k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
150
Transcript
Vueで学ぶデータ構造⼊⾨ リンクリストとキューで リアクティビティを捉える Vue Fes Japan 2025 After Talk 2025.11.11
SPEAKER 株式会社ヤプリ プロダクト開発本部 フロントエンドグループ マネージャー こん てぃらの という猫と暮らしています。 かわいい
INDEX ⽬次 1. はじめに 2. リアクティビティの仕組みとデータ構造
はじめに
今⽇のターゲット • Vue使い慣れてアプリ作れるようになった⼈、Vue1〜3年⽬くらいの⼈ • Vueを探求したい⼈ • Chibivue(https://book.chibivue.land/ja/)やった⼈ できるだけ簡単に、概念に触れながら詳細は省くので、厳密には違う部分もあり ます。後⽇ブログで補完する予定です🙏
今⽇扱う内容
https://roadmap.sh/computer-science
https://roadmap.sh/computer-science 👉
⾔語選択の次がデータ構造 👇
今⽇扱うVueのバージョン • 現⾏の3.5 • 絶賛alphaの3.6
今⽇のお題コード
リアクティビティの仕組みと データ構造
リアクティビティの仕組みを知ろう おれ(たち?)は雰囲気でリアクティビティAPIを使っている。 リアクティビティAPI同⼠がどうつながっているか知ろう! ❓
今⽇のお題コード(再掲)
それぞれのAPIの特性 refとcomputedは値を持ち、誰かに参照される computedとwatchEffectとtemplateは値を参照する →依存元(Dep) →購読者(Sub)
それぞれのAPIの特性 refとcomputedは値を持ち、誰かに参照される computedとwatchEffectとtemplateは値を参照する →依存元(Dep) →購読者(Sub) computedはどちらの特性も持つ
例えばこのコードなら、watchEffectがrefを参照したときにLinkができる ⼀対のDepとSubでLinkが作られる ref x watchEffect Link
Linkはいっぱいあってお互い繋がってる Link2 Link1 Link3 Link4 広がるリアクティブの輪
Linkのデータ構造
Linkのデータ構造 前後のDepが持つLinkがわかる 前後のSubが持つLinkがわかる
Linkのデータ構造 前後のDepが持つLinkがわかる 前後のSubが持つLinkがわかる 前後がわかる=双⽅向 これが双⽅向リンクリスト (Doubly-Linked List)
補⾜)リンクリストの種類 次だけわかる単⽅向リンクリスト 前後がわかる双⽅向リンクリスト
次はリアクティビティの輪が 作られる過程を⾒ましょう☝
とても雑なVueの処理の流れ 1. setup (<script setup>)が実⾏ 2. コンポーネントが画⾯に描画(=mount) 3. なんやかんやでリアクティブな状態が更新 4.
コンポーネントが画⾯に再描画
今⽇のお題コード(再掲)
setupで起きること 1 1. refが宣⾔される。
setupで起きること 1 2. computedが宣⾔される。(計算はまだしない)
setupで起きること 1 3. watchEffectが実⾏されてrefを参照してLink1が作られる。 (watchEffectの引数は即実⾏される) ref x watchEffect Link1
1. templateの描画が開始。 templateの描画で起きること 2 ref x watchEffect Link1
2 2. templateがrefを参照してLink2が作られる。 Link1から⾒てLink2のtemplateはnextSub、逆はprevSub。 ref x watchEffect Link1 ref x
template Link2 nextSub prevSub templateの描画で起きること
2 3. templateがcomputedを参照してLink3が作られる。computedはここで算出 Link2から⾒てLink3のcomputedはnextDep、逆はprevDep。 ref x watchEffect Link1 ref x
template Link2 computed x template Link3 nextSub prevSub prevDep nextDep templateの描画で起きること
2 4. computedがrefを参照してLink4が作られる。 Link2から⾒てLink4のcomputedはnextSub、逆はprevSub ref x watchEffect Link1 ref x
template Link2 computed x template Link3 ref x computed Link 4 nextSub prevSub nextSub prevSub prevDep nextDep templateの描画で起きること
これでsetupとtemplateの初期化終わり 次はリアクティブの更新!
refの更新で起きること 3 1. ボタンクリックでrefが更新される。 ref x watchEffect Link1 ref x
template Link2 computed x template Link3 ref x computed Link4 nextSub prevSub nextSub prevSub prevDep nextDep
2. refの更新が末尾のLink4のSubに通知される。 refの更新で起きること 3 ref x watchEffect Link1 ref x
template Link2 computed x template Link3 ref x computed Link 4 nextSub prevSub nextSub prevSub prevDep nextDep
3. Link4からprevSubを辿って、先頭のLink1のSubが 実⾏する処理をキューに⼊れる。 refの更新で起きること 3 ref x watchEffect Link1 ref
x template Link2 computed x template Link3 ref x computed Link4 Queue Link1の処理 nextSub prevSub nextSub prevSub prevDep nextDep ref ref ref
3. Link4からprevSubを辿って、先頭のLink1のSubが 実⾏する処理をキューに⼊れる。 refの更新で起きること 3 ref x watchEffect Link1 ref
x template Link2 computed x template Link3 ref x computed Link4 Queue Link1の処理 nextSub prevSub nextSub prevSub prevDep nextDep ref ref ref 満を持してキューが登場
refの更新で起きること 3 4. Link2のSubが実⾏する処理をキューに⼊れる。 ref x watchEffect Link1 ref x
template Link2 computed x template Link3 ref x computed Link4 Link2の処理 Queue Link1の処理 nextSub prevSub nextSub prevSub prevDep nextDep
refの更新で起きること 3 5. Link4のSubはcomputedなので後で実⾏する。 ref x watchEffect Link1 ref x
template Link2 computed x template Link3 ref x computed Link 4 Queue Link2の処理 Link1の処理 nextSub prevSub nextSub prevSub prevDep nextDep
再描画で起きること 4 1. ⾮同期でキューを順番に実⾏する。 まずはwatchEffectが実⾏。 ref x watchEffect Link1 ref
x template Link2 computed x template Link3 ref x computed Link4 Queue Link2の処理 Link1の処理 nextSub prevSub nextSub prevSub prevDep nextDep
再描画で起きること 4 2. 次にtemplateの描画が再実⾏。 ref x watchEffect Link1 ref x
template Link2 computed x template Link3 ref x computed Link4 Queue Link2の処理 nextSub prevSub nextSub prevSub prevDep nextDep
再描画で起きること 4 3. templateがLink2のDepのrefを参照する。 ref x watchEffect Link1 ref x
template Link2 computed x template Link3 ref x computed Link4 Queue nextSub prevSub nextSub prevSub prevDep nextDep
再描画で起きること 4 4. templateがLink3のDepのcomputedを参照する。 ここでcomputedが再計算! ref x watchEffect Link1 ref
x template Link2 computed x template Link3 ref x computed Link4 Queue nextSub prevSub nextSub prevSub prevDep nextDep
再描画で起きること 4 5. なんやかんやでtemplateの再描画が終わる。 ref x watchEffect Link1 ref x
template Link2 computed x template Link3 ref x computed Link4 Queue nextSub prevSub nextSub prevSub prevDep nextDep
めでたしめでたし🎉
Link(リンクリスト)の何が嬉しいのか • Linkのデータ構造はVue 3.5から登場しました。3.6でも使われる予定。 ◦ Refactor reactivity system to use
version counting and doubly-linked list tracking #10397 ◦ ↑3.5でメモリ効率とパフォーマンスがめっちゃ良くなったPR。3.6で更に良くなる! • 誰がどこにどの順番で依存しているかわかる。 • リアクティブな状態の依存関係は変わりうるので、変わったときでもO(1)の 計算量でリンクの追加削除ができる。
仕組みがわかると⾯⽩い これからVueを書くとき、 「ここでLinkが作られてLinkを通してDepに通知されてSubが実⾏されて リアクティブになってるんだなぁ‧‧‧☺」 とVueの暖かみを感じられるはず。
今⽇扱ったデータ構造 リンクリストもキューも⾊んなフレームワークで使われてるよ。React, Svelte, Preact, … キューは割と使うと思いますが、 リンクリストは普通のWebフロントエンド開発ではほぼ使わないと思います。
FOLLOW ME!! Yappli Tech Blog Yappli Developers カジュアル⾯談 @yappli_dev https://tech.yappli.io/
https://open.talentio.com/r/1/c/yappli/pages/59642