You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes, when using useMemo, you may need to utilize the previous value. To achieve this, let's implement a custom hook that memoizes not only the value of useMemo but also the previous value when the dependency list is updated.
Resolves#2819
**Changes:**
Introduces a new `useMemoWithPrevious` hook to manage previous and current values with reset capability, replacing the manual `useRef` implementation in ContainerLogModal. This hook provides a more robust way to track state changes while maintaining previous values.
**Implementation Details:**
- Created new `useMemoWithPrevious` hook that returns both current and previous values along with a reset function
- Updated ContainerLogModal to use the new hook for tracking log line numbers
- Replaced manual `previousLastLineNumber` ref management with the new hook's `resetPrevious` functionality
- Improved state management when switching kernel IDs or changing log sizes
**Testing Requirements:**
- Verify log highlighting works correctly when switching between different kernels
- Confirm previous line numbers are properly reset when changing log sizes
- Check that log display maintains proper highlighting of new content
Sometimes, when using
useMemo
, you may need to utilize the previous value. To achieve this, let's implement a custom hook that memoizes not only the value ofuseMemo
but also the previous value when the dependency list is updated.The text was updated successfully, but these errors were encountered: