:don: 170708

書いた

regression: media_attachmentのtext_urlがおかしい

Fix JSON serialization of media_attachment (regression from #4090) by unarist · Pull Request #4111 · tootsuite/mastodon · GitHub

わかりやすいところでは投稿時に自動挿入されるリンクがこれ。ついでに外部から来た画像はshortcodeないので除外。

regression: ピン留めされた通知カラムの初回読み込みが発生しない

Fix first loading of notifications when the column is pinned (regression from #3879) by unarist · Pull Request #4114 · tootsuite/mastodon · GitHub

これまで UI の componentWillMount で読み込んでいたが、reducers/notificationsを遅延読み込みするにあたって変更された箇所。ルート定義に渡すPromiseに挟んだものの、ピン留めされたカラムは ColumnsArea の方で読み込まれているので漏れていた。

他のカラムがcomponentDidMountでrefreshしてるのになぜhomeとnotificationsは、というのはつなぎっぱなしのhome or ポーリングがあるから。のでasync-components.jsに突っ込んでみたが、これはこれで微妙な感じ。

読んだ

Swipable Views

Swipeable views by sorin-davidoi · Pull Request #4105 · tootsuite/mastodon · GitHub

念願の、スワイプ途中が見える感じのやつ。ただしiOS9で試すと .react-swipeable-view-container > * { height: 100% } 足す必要があった。やっぱりiOS9だけなんだろうか。しかしreact-swipeable-view側で生成されてるclassなしの要素だから、直すならそっちに投げる感じかなあ。

regression: ルートのパラメータだけ変わった時に反映されない

fix: Rerender Bundle on route change by sorin-davidoi · Pull Request #4120 · tootsuite/mastodon

同じように直して、後でpushするかーって思ってたら先を越された。React的には単に関数を渡している扱いだったので、まさかインスタンスフィールドを通してそのメソッドの結果が変わるとは思っていなかった、というところだろうか。

パラメータが変化するたびにラムダ式作るのもいかがなものだろう、Reactらしい方法で渡した方がいいのではという気はするけど、まあここはそんなに頑張らなくてもいいか。

/aboutの刷新、埋め込みタイムライン

Redesign the landing page, mount public timeline on it by Gargron · Pull Request #4122 · tootsuite/mastodon

というか、この変更に至る経緯を眺めていた。

--- a/app/javascript/mastodon/store/configureStore.js
+++ b/app/javascript/mastodon/store/configureStore.js
@@ -2,10 +2,10 @@ import { createStore, applyMiddleware, compose } from 'redux';
 import thunk from 'redux-thunk';
 import appReducer, { createReducer } from '../reducers';
 import { hydrateStoreLazy } from '../actions/store';
-import { hydrateAction } from '../containers/mastodon';
 import loadingBarMiddleware from '../middleware/loading_bar';
 import errorsMiddleware from '../middleware/errors';
 import soundsMiddleware from '../middleware/sounds';
+import { hydrateAction } from '../containers/mastodon';
 
 export default function configureStore() {
   const store = createStore(appReducer, compose(applyMiddleware(

この configureStore() はこれまで /containers/mastodon.js からimportされていたのだけど、今回別のエントリポイントを作ってそこからも呼び出そうとした。ら、何故か configureStore() に突入した時点で loadingBarMiddleware が読み込まれていない。

で、hydrateAction をimportする問題の行。これが走ったところで /containers/mastodon.js が読み込まれ、初期化式が評価され…configureStore() が呼び出される。ああなるほどね。

どっちがわかりやすいのかわからないがブログの方にもこれで一記事書いた。 http://unarist.hatenablog.com/entry/2017/07/09/041744

件のimportを最後に持ってくることでエラーにならないようにしたようだけど、いや、やっぱり互いにimportしあうのは罠でしょう…。