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
Table cells, after performance optimization with custom events for handling soft focus and edit mode.
Current behavior
We use custom event with useEffect to handle soft focus and edit mode toggle in table cells.
The problem is that it's a pattern that opens for potentially many difficult to reproduce and to fix edge cases, like a cell staying open that blocks everything else.
Expected behavior
We want to go back to the previous idea, even if it lowers performances a bit, because it was a simple and predictable pattern.
The idea is to reimplement only one family state for a cell position, that contains everything a cell needs to know : soft focus, edit mode, loading, etc. So that there's only one recoil call being made.
The text was updated successfully, but these errors were encountered:
Steps to Remove Custom Events for Table Cell Management
Locate Custom Event Handlers: Identify and remove custom event handlers in the relevant components. These are likely found in files managing table cell states, such as TableCell.js or similar.
Remove useEffect Hooks: Remove useEffect hooks that handle custom events for soft focus and edit mode toggling.
Implement Single State Management:
Create a single Recoil state to manage cell properties (soft focus, edit mode, loading, etc.).
import{atom}from'recoil';exportconstcellState=atom({key: 'cellState',default: {softFocus: false,editMode: false,loading: false,// add other properties as needed},});
Update Components: Update table cell components to use the new Recoil state.
import{useRecoilState}from'recoil';import{cellState}from'./path/to/state';constTableCell=({ cellId })=>{const[state,setState]=useRecoilState(cellState(cellId));// Replace custom event logic with direct state updatesconsthandleFocus=()=>setState(prev=>({ ...prev,softFocus: true}));consthandleEditMode=()=>setState(prev=>({ ...prev,editMode: !prev.editMode}));return(<divonFocus={handleFocus}onClick={handleEditMode}>{/* Render cell content */}</div>);};
Remove Custom Event Logic: Ensure all custom event logic is removed and replaced with direct state manipulation using Recoil.
Refactor and Clean Up: Refactor the code to ensure consistency and remove any redundant code related to the old custom event system.
Scope & Context
Table cells, after performance optimization with custom events for handling soft focus and edit mode.
Current behavior
We use custom event with useEffect to handle soft focus and edit mode toggle in table cells.
The problem is that it's a pattern that opens for potentially many difficult to reproduce and to fix edge cases, like a cell staying open that blocks everything else.
Expected behavior
We want to go back to the previous idea, even if it lowers performances a bit, because it was a simple and predictable pattern.
The idea is to reimplement only one family state for a cell position, that contains everything a cell needs to know : soft focus, edit mode, loading, etc. So that there's only one recoil call being made.
The text was updated successfully, but these errors were encountered: