{"action":"created","issue":{"url":"https://api.github.com/repos/reflex-frp/reflex-dom/issues/106","repository_url":"https://api.github.com/repos/reflex-frp/reflex-dom","labels_url":"https://api.github.com/repos/reflex-frp/reflex-dom/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/reflex-frp/reflex-dom/issues/106/comments","events_url":"https://api.github.com/repos/reflex-frp/reflex-dom/issues/106/events","html_url":"https://github.com/reflex-frp/reflex-dom/pull/106","id":183453912,"number":106,"title":"Use listHoldWithKey in listWithKey","user":{"login":"spl","id":54900,"avatar_url":"https://avatars.githubusercontent.com/u/54900?v=3","gravatar_id":"","url":"https://api.github.com/users/spl","html_url":"https://github.com/spl","followers_url":"https://api.github.com/users/spl/followers","following_url":"https://api.github.com/users/spl/following{/other_user}","gists_url":"https://api.github.com/users/spl/gists{/gist_id}","starred_url":"https://api.github.com/users/spl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spl/subscriptions","organizations_url":"https://api.github.com/users/spl/orgs","repos_url":"https://api.github.com/users/spl/repos","events_url":"https://api.github.com/users/spl/events{/privacy}","received_events_url":"https://api.github.com/users/spl/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-17T15:48:49Z","updated_at":"2016-10-18T08:39:53Z","closed_at":"2016-10-18T05:49:27Z","pull_request":{"url":"https://api.github.com/repos/reflex-frp/reflex-dom/pulls/106","html_url":"https://github.com/reflex-frp/reflex-dom/pull/106","diff_url":"https://github.com/reflex-frp/reflex-dom/pull/106.diff","patch_url":"https://github.com/reflex-frp/reflex-dom/pull/106.patch"},"body":"In the process of upgrading to the latest `reflex-dom`, I found that `listWithKey` doesn't work as expected. I was previously using a definition based on `widgetHold` and #13, because the released one did not work. The following works for me with the latest `reflex-dom` in `develop`:\r\n\r\n```haskell\r\nlistWithKey\r\n  :: (Ord k, MonadWidget t m)\r\n  => Dynamic t (Map k v)\r\n  -> (k -> Dynamic t v -> m a)\r\n  -> m (Dynamic t (Map k a))\r\nlistWithKey mapD mkChild = widgetHold' child mempty mapEv\r\n  where\r\n    child m = forWithKeyA m $ \\k v ->\r\n      mkChild k =<< holdDyn v (fmapMaybe (Map.lookup k) mapEv)\r\n    mapEv = updated mapD\r\n\r\nwidgetHold'\r\n  :: (DomBuilder t m, MonadHold t m)\r\n  => (a -> m b)\r\n  -> a\r\n  -> Event t a -> m (Dynamic t b)\r\nwidgetHold' f edef e = widgetHold (f edef) (f <$> e)\r\n```\r\n\r\nThe problem is that I'm not seeing any updates to a widget defined with `listWithKey` when the `Dynamic` input changes. The events are triggered, according to my debugging, but there are no changes to the DOM.\r\n\r\nI looked into what might be wrong. I found `listWithKeyShallowDiff` rather cryptic. I'm not sure what it's doing. But it does seem like `listWithKeyShallowDiff` and `listWithKey` are each doing their own version of `Map` diff. Guessing that these diffs are redundant, I changed `listWithKey` to use `listHoldWithKey` instead. This seems to have fixed my problem. But I'm not sure why."},"comment":{"url":"https://api.github.com/repos/reflex-frp/reflex-dom/issues/comments/254443834","html_url":"https://github.com/reflex-frp/reflex-dom/pull/106#issuecomment-254443834","issue_url":"https://api.github.com/repos/reflex-frp/reflex-dom/issues/106","id":254443834,"user":{"login":"spl","id":54900,"avatar_url":"https://avatars.githubusercontent.com/u/54900?v=3","gravatar_id":"","url":"https://api.github.com/users/spl","html_url":"https://github.com/spl","followers_url":"https://api.github.com/users/spl/followers","following_url":"https://api.github.com/users/spl/following{/other_user}","gists_url":"https://api.github.com/users/spl/gists{/gist_id}","starred_url":"https://api.github.com/users/spl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spl/subscriptions","organizations_url":"https://api.github.com/users/spl/orgs","repos_url":"https://api.github.com/users/spl/repos","events_url":"https://api.github.com/users/spl/events{/privacy}","received_events_url":"https://api.github.com/users/spl/received_events","type":"User","site_admin":false},"created_at":"2016-10-18T08:39:53Z","updated_at":"2016-10-18T08:39:53Z","body":"Thanks, @ryantrinkle. Did you agree with the fact that the `Map` diffs are redundant? Can you point to any potential cause for the problem I was seeing? I'm afraid there might still be some underlying problem, for example, in `listWithKeyShallowDiff`."}}
{"actor":{"display_login":"spl"}}