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
20年続いているサービスの複雑な注文画面を GraphQL を使って改善した話
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
株式会社出前館
October 27, 2022
Technology
490
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
20年続いているサービスの複雑な注文画面を GraphQL を使って改善した話
株式会社出前館
October 27, 2022
More Decks by 株式会社出前館
See All by 株式会社出前館
中期計画、2回作ってみた ~業務委託と正社員、両方の視点から~
demaecan
1
1.1k
複雑にからみあう複数のシステムを要する出前館QAの実情、展望
demaecan
0
200
QA業務を変える(!?)AIを併用した不具合分析の実践
demaecan
0
210
出前館アプリの品質を支えるリリーストレインとその実践
demaecan
0
250
出前館アプリ進化論 アーキテクチャと組織のリアルな変⾰の舞台裏
demaecan
0
770
Flutterにしてよかった?出前館アプリを2年運用して気づいたことを全部話します
demaecan
1
1.2k
Boxを“使われる場”にする統制と自動化の仕組み
demaecan
1
470
生成AI導入における「短期ROIを超えた」共存戦略
demaecan
0
170
Okta Identity Governanceで実現する最小権限の原則
demaecan
1
490
Other Decks in Technology
See All in Technology
凡エンジニアがこの先生きのこるためには。〜TypeScript完全に理解したい〜
alchemy1115
2
310
Genie Ontologyは銀の弾丸かを考える / Is Genie Ontology a Silver Bullet?
nttcom
0
390
発表と総括 / Presentations and Summary
ks91
PRO
0
140
SRE依存からの脱却 運用を開 発チームへ移す、 フルサイ クル開 発体制の実践
joooee0000
0
3.1k
Type-safe IaC for Dart
coborinai
0
160
ソニー銀行におけるビジネスアジリティ向上のためのクラウドシフト戦略
srenext
0
720
Claude Code公式skillで 自分の仕事を少しずつ手放そう!(Claude Code開発ノウハウ大公開スペシャル by クラスメソッド)
kaym
1
480
SREとQA 二人三脚で進めるSLO運用/sre-qa-slo
sugitak
0
830
【Claude Code】鹿野さんに聞く 私の推しの並行開発環境 大公開 / claude-code-parallel-2026-07-15
tonkotsuboy_com
12
8.6k
見守りエージェントを作ってみた(ローカルLLM + Hermes Agent)
happysamurai294
0
110
Amazon EVS で VCF 9.0 / 9.1 のサポート開始まとめ
mtoyoda
0
310
型は壁、Rustでもバグを直すな、表現できなくせよ
nwiizo
14
2.1k
Featured
See All Featured
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
290
How to Talk to Developers About Accessibility
jct
2
390
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
870
Claude Code のすすめ
schroneko
67
230k
Writing Fast Ruby
sferik
630
63k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
530
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
180
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.4k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
170
Transcript
20年続いているサービスの 複雑な注文画面を GraphQLを使って改善した話 株式会社出前館・橋本茉利奈
橋本茉利奈 Hashimoto Marina 株式会社出前館 モバイルアプリエンジニア
None
出前館アプリ
注文画面
None
お届け時間
お届け時間 決済方法
お届け時間 決済方法 クーポン利用
お届け時間 決済方法 クーポン利用 LINEポイント
お届け時間 決済方法 クーポン利用 LINEポイント 特典の付与
お届け時間 決済方法 クーポン利用 LINEポイント 特典の付与 料金の再計算
お届け時間 決済方法 クーポン利用 LINEポイント 特典の付与 料金の再計算 めっちゃ切り替わる…😵
状態管理が大変…😵
状態管理が大変…😵 • 画面内に状態を管理しなければいけない要素が多い • 増え続ける決済パターン • ユーザ操作によって切り替わる注文情報 • ユーザへの許諾チェックボックスの表示制御 …etc
どうする…🤔
とにかくシンプルを目指す
RecoilをState管理に使ってみた • ねらい:State管理をできるだけシンプルにする • 要素をできるだけ細かく分解して管理する • Stateをどこからでも呼び出せる
screen RecoilをState管理に使ってみた Recoil Server user input item info amount coupon
delivery type LINE point order type terms agreement isEnabled receipt address phone number payment method
screen RecoilをState管理に使ってみた Recoil Server user input item info amount coupon
delivery type LINE point order type terms agreement isEnabled receipt address phone number payment method
screen RecoilをState管理に使ってみた Recoil Server user input item info amount coupon
delivery type LINE point order type terms agreement isEnabled receipt address phone number payment method 依存関係が多すぎる…😵
screen RecoilをState管理に使ってみた Recoil Server user input item info amount coupon
delivery type LINE point order type terms agreement isEnabled receipt address phone number payment method
screen RecoilをState管理に使ってみた Recoil Server user input item info amount coupon
delivery type LINE point order type terms agreement isEnabled receipt address phone number payment method
screen RecoilをState管理に使ってみた Recoil Server user input item info amount coupon
delivery type LINE point order type terms agreement isEnabled receipt address phone number payment method 頻繁に更新される…😵
screen RecoilをState管理に使ってみた Recoil Server user input item info amount coupon
delivery type LINE point order type terms agreement isEnabled receipt address phone number payment method かえって複雑に…😵
どうする…🤔
状態を2種類にわける
Server Cache / Local State
Server Cache • サーバの情報を保持するキャッシュ • サーバとクライアントの情報の一致が常に保証されている • キャッシュの値がコンポーネントへリアクティブに作用する
Local State • クライアントでのユーザ操作による情報を管理するState • クライアントのみで一時的に保持している値を管理
screen Server Cache / Local State Server user input Server
Cache Local State
注文画面で実装する💪
注文画面で実装する💪 • Server Cache → Apollo Client のキャッシュを使う • Local
State → React useState を使う
screen 注文画面で実装する💪 Apollo Server (BFF) user input Apollo Client Cache
useState
注文画面で実装する💪 • Server Cache → Apollo Client のキャッシュを使う • Local
State → React useState を使う
Server Cache→ apollo client のキャッシュを使う • BFFのレスポンス情報自体を、Server Cacheとして保持する • BFF
(GraphQL) によって、1画面描画のためのリクエストが1回で 済むのでServer Cacheの状態管理が容易 • BFFのスキーマで型定義できる
注文画面で実装する💪 • Server Cache → Apollo Clientのキャッシュを使う • Local State
→ React useState を使う
Local State → React useState を使う • Server Cacheのおかげで、Localで独自に定義するStateを減らすこと ができる
screen Before... Recoil Server user input item info amount coupon
delivery type LINE point order type terms agreement isEnabled receipt address phone number payment method
screen After... Apollo Server (BFF) user input Apollo Client Cache
useState isEnabled address payment method
まとめ
まとめ • 注文画面は、出前館アプリの中でも状態管理が大変な画面のひとつ • まずRecoilで管理する方法を試したものの、膨大な量のStateを管 理しなければならず、大変なことに...
まとめ • そこで、画面で管理するStateをSever CacheとLocal Stateの2種類に 分類して管理することにした
まとめ • Server Cacheとして, Apollo Client のキャッシュを活用することで 、型安全で、かつシンプルにサーバ情報を保持できるようになった
まとめ • Server Cacheがあるおかげで、ユーザ操作によって更新がかかる StateのみをLocal Stateで管理すれば良くなった
None