From fa86f488e1da91535119f66bd42dd08bfe620534 Mon Sep 17 00:00:00 2001 From: rstubryan Date: Tue, 3 Mar 2026 14:19:52 +0700 Subject: [PATCH] refactor(FE): Standardize search input placeholders to "Search" --- .../inventory/movement/MovementTable.tsx | 2 +- .../product/InventoryProductTable.tsx | 2 +- .../pages/master-data/area/AreasTable.tsx | 2 +- .../pages/master-data/bank/BanksTable.tsx | 2 +- .../master-data/customer/CustomersTable.tsx | 2 +- .../pages/master-data/flock/FlocksTable.tsx | 2 +- .../master-data/kandang/KandangsTable.tsx | 2 +- .../master-data/location/LocationsTable.tsx | 2 +- .../master-data/nonstock/NonstocksTable.tsx | 2 +- .../product-category/ProductCategoryTable.tsx | 2 +- .../master-data/product/ProductTable.tsx | 2 +- .../master-data/supplier/SupplierTable.tsx | 2 +- .../pages/master-data/uom/UomsTable.tsx | 2 +- .../master-data/warehouse/WarehousesTable.tsx | 2 +- .../production/recording/RecordingTable.tsx | 30 +++++++------------ 15 files changed, 24 insertions(+), 34 deletions(-) diff --git a/src/components/pages/inventory/movement/MovementTable.tsx b/src/components/pages/inventory/movement/MovementTable.tsx index c85577de..f53b0ccb 100644 --- a/src/components/pages/inventory/movement/MovementTable.tsx +++ b/src/components/pages/inventory/movement/MovementTable.tsx @@ -181,7 +181,7 @@ const MovementTable = () => {
{
{
{
{
{
{
{
{
{
{
{
{
{
{ - const { searchValue, setSearchValue, resetSearchValue } = useUiStore(); - const previousPathRef = useRef(null); + const { searchValue, setSearchValue, setTableState } = useUiStore(); + const pathname = usePathname(); const { state: tableFilterState, @@ -214,7 +215,7 @@ const RecordingTable = () => { toQueryString: getTableFilterQueryString, } = useTableFilter({ initial: { - search: searchValue, + search: '', areaFilter: '', locationFilter: '', kandangFilter: '', @@ -229,6 +230,10 @@ const RecordingTable = () => { }, }); + useEffect(() => { + updateFilter('search', searchValue); + }, [searchValue, updateFilter]); + // ===== FILTER MODAL STATE ===== const filterModal = useModal(); @@ -526,23 +531,8 @@ const RecordingTable = () => { }, []); useEffect(() => { - previousPathRef.current = window.location.pathname; - - return () => { - const currentPath = window.location.pathname; - - const isCurrentPathRecording = currentPath.includes( - '/production/recording' - ); - const isPreviousPathRecording = previousPathRef.current?.includes( - '/production/recording' - ); - - if (isPreviousPathRecording && !isCurrentPathRecording) { - resetSearchValue(); - } - }; - }, [resetSearchValue]); + setTableState('recording-table', pathname); + }, [pathname]); const searchChangeHandler = useCallback( (e: React.ChangeEvent) => {