luffyZh / next-antd-scaffold

🏠 A simple scaffold based on Next.js for quick use with ant-design, redux, redux-saga, fetch and pm2.

Home Page:https://next-antd-scaffold.luffyzh.now.sh/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ant design style flash when page refresh and low performance

Pfurr opened this issue · comments

commented

hi @luffyZh, sorry for this open issue, anyway it is not completely related to your repo! (:

i'm working with next js and with and-design i have several issues:

  • the ant-design ui flashing when page refresh, i use css modules
  • poor performance

you can help me to fix? I add my code: https://codesandbox.io/s/priceless-heyrovsky-0pu29?file=/pages/index.js

@pherm

Thank you very much for your attention. It doesn't matter to issue in this repo. But as for your question, I think the Suggestions are as follows:

  • First of all, the reason for this problem is CSS Modules. Dom Tree parsed in the development environment does not have CSS styles.(Or u can insert css in the serverside)

  • Second, this problem does not occur in production environments, which means that only the development environment flashes, I think you can ignore.

  • In the end, in fact I suggest you use styled-jsx, after all next.js && styled-jsx is a team so have better compatibility

If there are any other questions, u can continue the conversation, I will close the issue ~

commented

@pherm

Grazie per la vostra attenzione. Non importa in questo repository. Ma per quanto riguarda la tua domanda, penso che i suggerimenti siano i seguenti:

  • Prima di tutto, la ragione di questo problema sono i moduli CSS. Dom Tree analizzato nell'ambiente di sviluppo non ha stili CSS (oppure puoi inserire CSS nel lato server)
  • In secondo luogo, questo problema non si verifica negli ambienti di produzione, il che significa che solo l'ambiente di sviluppo lampeggia, penso che tu possa ignorare.
  • Alla fine, infatti, ti suggerisco di usare styled-jsx, dopo tutto next.js && styled-jsxè una squadra, quindi avere una migliore compatibilità

Se ci sono altre domande, puoi continuare la conversazione, chiuderò il problema ~

thank you for your reply! :)