Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Question: How is the stack lifecycle (`activities` array) intended to be managed?

Đang mở
#631 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tài liệu
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
react, typescript
Lĩnh vực
frontend, mobile-dev

Hướng nghiên cứu

Bắt đầu với tài liệu chính thức về useStack() và vòng đời của các activity xoay quanh push, replace và pop. Xác định xem array có được cố ý chỉ cho phép nối thêm hay không, và việc quay lại root có nên cắt bớt nó hay vẫn có thể quan sát được thông qua transitionState, isTop và isActive. Hoàn tất có nghĩa là ghi lại hành vi dự kiến hoặc xác định yêu cầu reset/cắt bớt rõ ràng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

According to the official documentation, the useStack() hook can be used to access the stack state within UI components. However, when examining the activities array returned from useStack(), I noticed that its length increases by one each time the push or replace functions are called, and does not decrease when the pop function is invoked.

It is true that by checking properties such as transitionState, isTop, or isActive, one can determine which screen the user is currently viewing. Still, if the user repeatedly performs push or replace operations, the array continues to grow regardless of what the user actually sees. Intuitively, in scenarios such as when the user has finished navigating and returned to the root activity, one would expect the array to reset. Without some form of cleanup, the length of the array could, at least in theory, grow without bound.

As far as I know, Stackflow does not currently provide an API to reset or trim the stack state array in this manner. Of course, since Stackflow is obviously well-designed to be easily extended and customized through plugins, I imagine it would not be very difficult for me to implement additional functionality by myself if needed. That said, before proceeding, I would like to confirm whether my understanding aligns with the framework’s intended design. Or am I perhaps misunderstanding how the lifecycle of the stack is meant to be managed?

Ngôn ngữ chính
TypeScript
Star
1k
Fork
114
Merge trung bình
59 phút
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của daangn/stackflow

Tất cả issue của daangn/stackflow

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.