{"action":"created","issue":{"url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/2338","repository_url":"https://api.github.com/repos/MithrilJS/mithril.js","labels_url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/2338/labels{/name}","comments_url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/2338/comments","events_url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/2338/events","html_url":"https://github.com/MithrilJS/mithril.js/issues/2338","id":391235614,"node_id":"MDU6SXNzdWUzOTEyMzU2MTQ=","number":2338,"title":"Changing the order of vnodes  with cached content has weird results.","user":{"login":"darionco","id":2651846,"node_id":"MDQ6VXNlcjI2NTE4NDY=","avatar_url":"https://avatars1.githubusercontent.com/u/2651846?v=4","gravatar_id":"","url":"https://api.github.com/users/darionco","html_url":"https://github.com/darionco","followers_url":"https://api.github.com/users/darionco/followers","following_url":"https://api.github.com/users/darionco/following{/other_user}","gists_url":"https://api.github.com/users/darionco/gists{/gist_id}","starred_url":"https://api.github.com/users/darionco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darionco/subscriptions","organizations_url":"https://api.github.com/users/darionco/orgs","repos_url":"https://api.github.com/users/darionco/repos","events_url":"https://api.github.com/users/darionco/events{/privacy}","received_events_url":"https://api.github.com/users/darionco/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-12-14T19:24:38Z","updated_at":"2018-12-14T20:03:21Z","closed_at":null,"author_association":"NONE","body":"### Mithril Version: 1.1.6\r\nI am working on a 3D mapping application where you can get tooltips attached to geographical locations, when the user moves the map around (since it's 3D) the render order of the tooltips has to change some times to accommodate for perspective changes.\r\n\r\nThe tooltips hold large, static,  expensive to create content so I create and cache the vnodes (remember the content is static so no anti-pattern here as per the documentation).  At runtime I reorder the tooltips and create new vnodes with their updated positions and then add their respective cached content vnodes.\r\n\r\nWhen the tooltips do not change render order everything works as expected, but as soon as they change order the content starts shifting from one tooltip to the next and sometimes it gets duplicated (depending on the type of content).\r\n\r\n## Expected Behavior\r\nThat the static content stays inside the appropriate tooltip.\r\n\r\n## Current Behavior\r\nContent jumps between tooltips and gets duplicated.\r\n\r\n## Possible Solution\r\n1. Recreating the static content vnodes every time the tooltips position is changed\r\n2. Making the tooltip a new component every render also seems to work:\r\n```\r\nm(() => { view: () => m('div', content) }\r\n```\r\nrather than\r\n```\r\nm('div', content)\r\n```\r\n\r\n## Steps to Reproduce\r\nhttps://codepen.io/anon/pen/vvGKzo?editors=0110\r\n- Change the `heightOffset` value on the top right menu\r\n- Observe how the tooltip number changes as the tooltips cross the center line\r\n- Comment line 14 and uncomment line 15 to use `m.trust`\r\n- Change `heightOffset`\r\n- Observe how content changes tooltip and gets duplicated every time the order changes.\r\n\r\n## Context\r\nRecreating the vnodes every frame would be too expensive as this is an application that runs in real time and the tooltips can hold a lot of information and sub-nodes. It would be better if mithrill could respect unchanged vnodes.\r\n\r\n## Your Environment\r\nSee the example under reproduction steps.\r\n"},"comment":{"url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/comments/447438833","html_url":"https://github.com/MithrilJS/mithril.js/issues/2338#issuecomment-447438833","issue_url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/2338","id":447438833,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NzQzODgzMw==","user":{"login":"darionco","id":2651846,"node_id":"MDQ6VXNlcjI2NTE4NDY=","avatar_url":"https://avatars1.githubusercontent.com/u/2651846?v=4","gravatar_id":"","url":"https://api.github.com/users/darionco","html_url":"https://github.com/darionco","followers_url":"https://api.github.com/users/darionco/followers","following_url":"https://api.github.com/users/darionco/following{/other_user}","gists_url":"https://api.github.com/users/darionco/gists{/gist_id}","starred_url":"https://api.github.com/users/darionco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darionco/subscriptions","organizations_url":"https://api.github.com/users/darionco/orgs","repos_url":"https://api.github.com/users/darionco/repos","events_url":"https://api.github.com/users/darionco/events{/privacy}","received_events_url":"https://api.github.com/users/darionco/received_events","type":"User","site_admin":false},"created_at":"2018-12-14T20:03:21Z","updated_at":"2018-12-14T20:03:21Z","author_association":"NONE","body":"duh!\r\nthat was my bad, keying totally works.\r\n\r\nThanks!"}}
{"actor":{"display_login":"darionco"}}