{"action":"closed","issue":{"url":"https://api.github.com/repos/mui-org/material-ui/issues/10175","repository_url":"https://api.github.com/repos/mui-org/material-ui","labels_url":"https://api.github.com/repos/mui-org/material-ui/issues/10175/labels{/name}","comments_url":"https://api.github.com/repos/mui-org/material-ui/issues/10175/comments","events_url":"https://api.github.com/repos/mui-org/material-ui/issues/10175/events","html_url":"https://github.com/mui-org/material-ui/issues/10175","id":294366164,"number":10175,"title":"Disable classname generation for the whole app","user":{"login":"Aetherall","id":13298494,"avatar_url":"https://avatars2.githubusercontent.com/u/13298494?v=4","gravatar_id":"","url":"https://api.github.com/users/Aetherall","html_url":"https://github.com/Aetherall","followers_url":"https://api.github.com/users/Aetherall/followers","following_url":"https://api.github.com/users/Aetherall/following{/other_user}","gists_url":"https://api.github.com/users/Aetherall/gists{/gist_id}","starred_url":"https://api.github.com/users/Aetherall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aetherall/subscriptions","organizations_url":"https://api.github.com/users/Aetherall/orgs","repos_url":"https://api.github.com/users/Aetherall/repos","events_url":"https://api.github.com/users/Aetherall/events{/privacy}","received_events_url":"https://api.github.com/users/Aetherall/received_events","type":"User","site_admin":false},"labels":[{"id":299360691,"url":"https://api.github.com/repos/mui-org/material-ui/labels/discussion","name":"discussion","color":"bfdadc","default":false}],"state":"closed","locked":false,"assignee":{"login":"oliviertassinari","id":3165635,"avatar_url":"https://avatars2.githubusercontent.com/u/3165635?v=4","gravatar_id":"","url":"https://api.github.com/users/oliviertassinari","html_url":"https://github.com/oliviertassinari","followers_url":"https://api.github.com/users/oliviertassinari/followers","following_url":"https://api.github.com/users/oliviertassinari/following{/other_user}","gists_url":"https://api.github.com/users/oliviertassinari/gists{/gist_id}","starred_url":"https://api.github.com/users/oliviertassinari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliviertassinari/subscriptions","organizations_url":"https://api.github.com/users/oliviertassinari/orgs","repos_url":"https://api.github.com/users/oliviertassinari/repos","events_url":"https://api.github.com/users/oliviertassinari/events{/privacy}","received_events_url":"https://api.github.com/users/oliviertassinari/received_events","type":"User","site_admin":false},"assignees":[{"login":"oliviertassinari","id":3165635,"avatar_url":"https://avatars2.githubusercontent.com/u/3165635?v=4","gravatar_id":"","url":"https://api.github.com/users/oliviertassinari","html_url":"https://github.com/oliviertassinari","followers_url":"https://api.github.com/users/oliviertassinari/followers","following_url":"https://api.github.com/users/oliviertassinari/following{/other_user}","gists_url":"https://api.github.com/users/oliviertassinari/gists{/gist_id}","starred_url":"https://api.github.com/users/oliviertassinari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliviertassinari/subscriptions","organizations_url":"https://api.github.com/users/oliviertassinari/orgs","repos_url":"https://api.github.com/users/oliviertassinari/repos","events_url":"https://api.github.com/users/oliviertassinari/events{/privacy}","received_events_url":"https://api.github.com/users/oliviertassinari/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2018-02-05T11:51:05Z","updated_at":"2018-02-07T09:49:22Z","closed_at":"2018-02-07T09:49:22Z","author_association":"NONE","body":"- [x] I have searched the [issues](https://github.com/mui-org/material-ui/issues) of this repository and believe that this is not a duplicate.\r\n\r\n## Expected Behavior\r\n\r\nOn the server :\r\nThe classname generation should occur once\r\n\r\nOn the client:\r\nThe classname generation should occur once\r\n\r\nBoth classnames generation should match\r\n\r\n#### ===========\r\n\r\nI should be able to avoid using MuiThemeProvider at the root of my app while still be able to disable classname generation\r\n\r\nI should be able to use MUI on a route and not on another\r\n\r\ndisabling classname generation should be for the whole tree, even if I got multiple sub MuiThemeProviders\r\n\r\n\r\n\r\n## Current Behavior\r\nOn the server :\r\nThe classname generation occur twice\r\nThe first one when using apollo's getDataFromTree\r\nThe second one when using reactDOMServer's renderToString\r\n\r\nOn the client:\r\nThe classname generation occur once, and  doesn't match the one made by the server\r\n\r\nThe client classname generation matches the first server classname generation, but the classnames rendered on the react components are thoses from the servers's second classname generation\r\n\r\nThis is because to disable classname generation on one of the renders, I am forced to use MuiThemeProvider at the root of the tree, so i can dynamically pass \"disableStylesGeneration\"\r\n\r\n## Concerns\r\n\r\nBut what if I dont want to have MuiThemeProvider at the root of my App ?\r\nIn the most cases, the visitor will only hit the home page, so no need to make the server render an useless component\r\nAlso, what if I got the multiple MuiThemeProvider pattern ?\r\n\r\n\r\n## Steps to Reproduce (for bugs)\r\n\r\nI made a repository to illustrate the problem\r\n\r\nhttps://github.com/Aetherall/MUI-issue\r\n\r\n## Context ( based on  https://github.com/Aetherall/MUI-issue )\r\n\r\nI got a SSR app with two Pages\r\nHome : No MUI\r\nDashboard: MUI\r\nMultiple: MUI - Multiple Nested Providers\r\n\r\nI don't want to use MuiThemeProvider at the root of the App, because it would mean useless execution for the majority of the visitors, which only visit Home\r\n\r\n\r\n\r\n## Idea\r\n\r\nThe solution would be to make MuiThemeProvider get the \"disableStylesGeneration\" from context, and use that if no props are provided\r\nThen, we just have to make a <NoStyles/> component which takes a disable bool prop\r\nThe component just inject the disableStylesGeneration value in the context depending on the value of his disable prop\r\n\r\n\r\n| Tech         | Version |\r\n|--------------|---------|\r\n| Material-UI  |   ^1.0.0-beta.31      |\r\n| React        |   ^16.2.0      |\r\n| react-jss      |  ^8.2.1       |\r\n"}}
{"actor":{"display_login":"oliviertassinari"}}