Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 구조

TanStack Query는 외부 라이브리에 의존하지 않는 코어 영역의 코드가 패키지로 분리되어 있습니다. [query-core](https://github.com/TanStack/query/tree/main/packages/query-core) 패키지로 관리되고 있으며 QueryCache, QueryClient와 같은 코드가 구현되어 있습니다.
TanStack Query는 외부 라이브러리에 의존하지 않는 코어 영역의 코드가 패키지로 분리되어 있습니다. [query-core](https://github.com/TanStack/query/tree/main/packages/query-core) 패키지로 관리되고 있으며 QueryCache, QueryClient와 같은 코드가 구현되어 있습니다.

TanStack Query는 특정 라이브러리에서 바로 사용할 수 있는 패키지도 관리하고 있습니다. 기반은 query-core 패키지를 사용하며 라이브러리의 문법과 생명주기에 맞춰서 query-core 코드를 의존하고 있습니다.

Expand Down
4 changes: 2 additions & 2 deletions docs/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Query는 서버 상태를 조회하고 관리하는 객체입니다. Query 객

### `staleTime`은 어떻게 동작하나요?

Query는 서버 상태가 마지막으로 변경된 시점을 `lastUpdated` 변수로 저장하고 있습니다. fetch 메소드가 실행되기 전 `Date.now() - lastUpdated` 값이 `staleTime` 보다 큰 경우에만 `fetch` 메소들르 실행시킵니다.
Query는 서버 상태가 마지막으로 변경된 시점을 `lastUpdated` 변수로 저장하고 있습니다. fetch 메소드가 실행되기 전 `Date.now() - lastUpdated` 값이 `staleTime` 보다 큰 경우에만 `fetch` 메소드를 실행시킵니다.

| `Date.now() - lastUpdated` > `staleTime` | `fetch` 실행 여부 |
| :--------------------------------------: | :---------------: |
Expand Down Expand Up @@ -187,7 +187,7 @@ class Query {
this.clearGcTimeout();

const unsubscribe = () => {
this.observers = this.observers.filter(() => {
this.observers = this.observers.filter((d) => {
return d !== observer;
});

Expand Down
2 changes: 1 addition & 1 deletion docs/window-focus-refetching.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class QueryCache {

focus 상태 변경에 대한 감지는 document 객체의 [visibilitychange](https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilitychange_event) 이벤트를 기반으로 감지할 수 있습니다.

`visibilitychange` 이벤트가 발생할 때 `document.visibilityState !== hidden` 인 경우, 브라우저의 focus가 다시 활성화된 상태로 판단할 수 있습니다. 브랑줘의 focus가 다시 활성화 된 경우, QueryCache의 `focus` 메소드를 호출하여 활성화 된 Query들에게 fetch를 발생시킬 수 있다.
`visibilitychange` 이벤트가 발생할 때 `document.visibilityState !== hidden` 인 경우, 브라우저의 focus가 다시 활성화된 상태로 판단할 수 있습니다. 브라우저의 focus가 다시 활성화된 경우, QueryCache의 `focus` 메소드를 호출하여 활성화 된 Query들에게 fetch를 발생시킬 수 있다.

```jsx
export const QueryClientProvider = ({ children, client }) => {
Expand Down