{"action":"created","issue":{"url":"https://api.github.com/repos/reactioncommerce/reaction/issues/3284","repository_url":"https://api.github.com/repos/reactioncommerce/reaction","labels_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/3284/labels{/name}","comments_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/3284/comments","events_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/3284/events","html_url":"https://github.com/reactioncommerce/reaction/issues/3284","id":273572207,"number":3284,"title":"Improve unnecessary translation loading","user":{"login":"aldeed","id":3012067,"avatar_url":"https://avatars1.githubusercontent.com/u/3012067?v=4","gravatar_id":"","url":"https://api.github.com/users/aldeed","html_url":"https://github.com/aldeed","followers_url":"https://api.github.com/users/aldeed/followers","following_url":"https://api.github.com/users/aldeed/following{/other_user}","gists_url":"https://api.github.com/users/aldeed/gists{/gist_id}","starred_url":"https://api.github.com/users/aldeed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aldeed/subscriptions","organizations_url":"https://api.github.com/users/aldeed/orgs","repos_url":"https://api.github.com/users/aldeed/repos","events_url":"https://api.github.com/users/aldeed/events{/privacy}","received_events_url":"https://api.github.com/users/aldeed/received_events","type":"User","site_admin":false},"labels":[{"id":669567032,"url":"https://api.github.com/repos/reactioncommerce/reaction/labels/chore","name":"chore","color":"c5def5","default":false},{"id":539719712,"url":"https://api.github.com/repos/reactioncommerce/reaction/labels/performance","name":"performance","color":"FF00FF","default":false}],"state":"open","locked":false,"assignee":{"login":"mikemurray","id":42217,"avatar_url":"https://avatars3.githubusercontent.com/u/42217?v=4","gravatar_id":"","url":"https://api.github.com/users/mikemurray","html_url":"https://github.com/mikemurray","followers_url":"https://api.github.com/users/mikemurray/followers","following_url":"https://api.github.com/users/mikemurray/following{/other_user}","gists_url":"https://api.github.com/users/mikemurray/gists{/gist_id}","starred_url":"https://api.github.com/users/mikemurray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikemurray/subscriptions","organizations_url":"https://api.github.com/users/mikemurray/orgs","repos_url":"https://api.github.com/users/mikemurray/repos","events_url":"https://api.github.com/users/mikemurray/events{/privacy}","received_events_url":"https://api.github.com/users/mikemurray/received_events","type":"User","site_admin":false},"assignees":[{"login":"mikemurray","id":42217,"avatar_url":"https://avatars3.githubusercontent.com/u/42217?v=4","gravatar_id":"","url":"https://api.github.com/users/mikemurray","html_url":"https://github.com/mikemurray","followers_url":"https://api.github.com/users/mikemurray/followers","following_url":"https://api.github.com/users/mikemurray/following{/other_user}","gists_url":"https://api.github.com/users/mikemurray/gists{/gist_id}","starred_url":"https://api.github.com/users/mikemurray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikemurray/subscriptions","organizations_url":"https://api.github.com/users/mikemurray/orgs","repos_url":"https://api.github.com/users/mikemurray/repos","events_url":"https://api.github.com/users/mikemurray/events{/privacy}","received_events_url":"https://api.github.com/users/mikemurray/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/reactioncommerce/reaction/milestones/67","html_url":"https://github.com/reactioncommerce/reaction/milestone/67","labels_url":"https://api.github.com/repos/reactioncommerce/reaction/milestones/67/labels","id":3120554,"number":67,"title":"Release 1.9","description":"Performance sprint 2","creator":{"login":"spencern","id":1203639,"avatar_url":"https://avatars0.githubusercontent.com/u/1203639?v=4","gravatar_id":"","url":"https://api.github.com/users/spencern","html_url":"https://github.com/spencern","followers_url":"https://api.github.com/users/spencern/followers","following_url":"https://api.github.com/users/spencern/following{/other_user}","gists_url":"https://api.github.com/users/spencern/gists{/gist_id}","starred_url":"https://api.github.com/users/spencern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spencern/subscriptions","organizations_url":"https://api.github.com/users/spencern/orgs","repos_url":"https://api.github.com/users/spencern/repos","events_url":"https://api.github.com/users/spencern/events{/privacy}","received_events_url":"https://api.github.com/users/spencern/received_events","type":"User","site_admin":false},"open_issues":38,"closed_issues":7,"state":"open","created_at":"2018-02-15T20:30:35Z","updated_at":"2018-02-22T07:37:56Z","due_on":"2018-03-05T08:00:00Z","closed_at":null},"comments":4,"created_at":"2017-11-13T20:47:25Z","updated_at":"2018-02-22T22:19:25Z","closed_at":null,"author_association":"MEMBER","body":"Something I noticed while working on SimpleSchema changes...\r\n\r\n`loadTranslations` runs for each plugin with translations, every time the server restarts, doing a ton of upserts that are essentially no-ops. This *might* not be necessary on every startup in production, but it's *definitely* not necessary on every startup while developing.\r\n\r\nThe solution would probably involve some combination of caching/comparing a checksum and/or testing whether we're in production mode. Might also help to have a version in each json file.\r\n\r\nOr the whole thing could be triggered manually by an admin instead of on startup.\r\n\r\nI haven't given it enough thought to know what's best, but I wanted to mention it before I forget.\r\n\r\nPotentially dynamic imports solves this issue.\r\n\r\nConsider adding a configuration file for enabled languages. \r\n\r\nImport languages once a shop has toggled on i18n.\r\n\r\nHook `i18n/flushTranslations` up to a button in reaction devtools to make resetting translations easily."},"comment":{"url":"https://api.github.com/repos/reactioncommerce/reaction/issues/comments/367842019","html_url":"https://github.com/reactioncommerce/reaction/issues/3284#issuecomment-367842019","issue_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/3284","id":367842019,"user":{"login":"mikemurray","id":42217,"avatar_url":"https://avatars3.githubusercontent.com/u/42217?v=4","gravatar_id":"","url":"https://api.github.com/users/mikemurray","html_url":"https://github.com/mikemurray","followers_url":"https://api.github.com/users/mikemurray/followers","following_url":"https://api.github.com/users/mikemurray/following{/other_user}","gists_url":"https://api.github.com/users/mikemurray/gists{/gist_id}","starred_url":"https://api.github.com/users/mikemurray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikemurray/subscriptions","organizations_url":"https://api.github.com/users/mikemurray/orgs","repos_url":"https://api.github.com/users/mikemurray/repos","events_url":"https://api.github.com/users/mikemurray/events{/privacy}","received_events_url":"https://api.github.com/users/mikemurray/received_events","type":"User","site_admin":false},"created_at":"2018-02-22T22:19:25Z","updated_at":"2018-02-22T22:19:25Z","author_association":"MEMBER","body":"To use FS to load these i18n files, they will have to be included in the final bundle, for production. As far as I know, with the imports directory, you'll have to have imported the files you want to be included with the production bundle from a file outside the imports directory, like the `plugins.js` files in `client` and `server`.\r\n\r\nIn development mode it's fine since we have access to the filesystem, but once everything it built, we won't have access to those translation files. Some translations still live in \"/private\" and we do use FS to load them.\r\n\r\nRemoving the actual imports could help the Babel transilpation run faster, and where would be 1000 less files to watch by Meteor.\r\n\r\n---\r\n\r\nReducing DB ops could be as simple checking if translation have been loaded into the Assets collection, and if they are, then stop there. Then theres a button to flush and reload those files Assets and let the import run as usual.\r\n\r\nI cannot speak to the actual cost or performance of those DB operations.\r\n\r\n@spencern thoughts?"}}
{"actor":{"display_login":"mikemurray"}}