GithubHelp home page GithubHelp logo

khj0426 / hj_devlog Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 0.0 24.55 MB

Next js 13으로 만든 개발 블로그

Home Page: https://hj-devlog.vercel.app

JavaScript 2.78% TypeScript 90.50% CSS 2.17% Shell 0.03% MDX 4.52%
nextjs-app-router nextjs-appdir nextjs-example nextjs13

hj_devlog's Introduction

hj_devlog's People

Contributors

khj0426 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

hj_devlog's Issues

Plaiceholder라이브러리 esm모듈만 지원 -> 블러 이미지로 바꾸는 cjs모듈 형식의 라이브러리가 존재하는지 찾는다.

esm모듈의 .mjs로 next config을 수정하면 서버 액션이 작동하지 않고 빌드 에러가 발생
(mjs형식은 아직 서버 액션이 적용 안되는 듯 하다..)

vercel/next.js#62569 (comment)

next config을 .mjs로 바꾸면 esm모듈형식이고 트리쉐이킹이 적용되어서 모든 파일의 빌드 용량이 줄어드는 장점이 있음
그러나 당장 .mjs을 쓰면 vercel 배포 환경에서 에러가 발생한다.

image

일단 plaiceholder라이브러리를 안쓰고 config파일을 다시 .mjs에서 돌려놨는데 esm + cjs모듈 시스템을 지원하는 이미지 블러 처리 라이브러리를 찾아봐야 한다!

모든 블로그 글에 대해 조회 수 기능을 추가한다.

  • 조회 수 기능 추가

어느 시점에 조회를 판단할 것인가.

firsbase의 logEvent메소드로 이벤트 로깅을 하고 firebase DB의 조회수 필드를 업데이트한다.
특정 글의 조회를 해야 하므로 동적 라우팅 경로에 진입했을 시 판단한다.

  • middleware로 제어하는 방법
  • useEffect로 마운트 시 제어하는 방법

두 방법의 장,단점 비교해서 나은 방법으로 구현하기

//logEvent 예시
import { getAnalytics, logEvent } from "firebase/analytics";

const analytics = getAnalytics();
logEvent(analytics, 'select_content', {
  content_type: 'image',
  content_id: 'P12453'
});

[문제점] 처음 페이지 로드 후 다크모드로 전활될떄, 버튼의 전환의 시간이 600ms가 걸리는 문제가 존재한다.

문제점

다크모드로 전환될때 버튼을 누른 시점은 2000밀리초가 지난 후

image

그러나 다크모드로 전환되고 버튼의 이미지가 정상적으로 바뀐 시점은 2600밀리초 시점

image

원인

lightmode,darkmode의 이미지 중 단 하나의 이미지만 불러오는 것을 확인할 수 있었다!

아래의 이미지만 불러오고, 버튼을 누를떄 추가적인 이미지가 불러와지는 모습도 확인 할 수 있었다!

image

이 과정에서 600ms가 소요된다!

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.