@haloduck/ui 2.0.25 → 2.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3007,6 +3007,12 @@ class TableComponent {
3007
3007
  .subscribe(() => {
3008
3008
  this.setupIntersectionObserver();
3009
3009
  });
3010
+ // 데이터 행 렌더링 변화에 맞춰 센티널 타겟을 재지정
3011
+ this.dataRows?.changes
3012
+ .pipe(takeUntilDestroyed(this.destroyRef))
3013
+ .subscribe(() => {
3014
+ this.setupIntersectionObserver();
3015
+ });
3010
3016
  const container = this.scrollContainer?.nativeElement;
3011
3017
  this.scrollListenerTarget = container || (typeof window !== 'undefined' ? window : undefined);
3012
3018
  if (this.scrollListenerTarget) {
@@ -3038,7 +3044,7 @@ class TableComponent {
3038
3044
  this.intersectionObserver = new IntersectionObserver(this.onIntersection, {
3039
3045
  root: rootElement || undefined,
3040
3046
  rootMargin: '0px 0px 200px 0px',
3041
- threshold: 0.5,
3047
+ threshold: 0.05,
3042
3048
  });
3043
3049
  this.intersectionObserver.observe(target);
3044
3050
  });
@@ -3054,17 +3060,20 @@ class TableComponent {
3054
3060
  for (const entry of entries) {
3055
3061
  if (!entry.isIntersecting)
3056
3062
  continue;
3057
- if (!this.hasObservedOnce) {
3058
- // 교차는 무시: 옵저버가 생성될 때 현재 화면에 이미 보이는 경우를 방지
3063
+ const container = this.scrollContainer?.nativeElement;
3064
+ const allowWithoutScroll = !container || container.scrollHeight <= container.clientHeight;
3065
+ if (!this.hasObservedOnce && !allowWithoutScroll) {
3066
+ // 내부 스크롤 컨테이너가 있고 첫 교차는 무시
3059
3067
  this.hasObservedOnce = true;
3060
3068
  continue;
3061
3069
  }
3062
- // 마지막 키가 존재, 로딩 아님, 그리고 실제 스크롤이 있었을 때만 로드
3070
+ // 마지막 키가 존재, 로딩 아님, 그리고 (실제 스크롤 발생 or 스크롤 불필요)일 때만 로드
3063
3071
  Promise.all([
3064
3072
  firstValueFrom(this.lastEvaluatedKey.pipe(take(1))),
3065
3073
  firstValueFrom(this.isLoading.pipe(take(1))),
3066
3074
  ]).then(([lastKey, isLoading]) => {
3067
- if (!(lastKey && !isLoading && this.didScrollSinceLastLoad)) {
3075
+ const scrolledOk = this.didScrollSinceLastLoad || allowWithoutScroll;
3076
+ if (!(lastKey && !isLoading && scrolledOk)) {
3068
3077
  return;
3069
3078
  }
3070
3079
  // 중복 호출 방지: 즉시 관찰 해제 후 로드 트리거