Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Fix]: #1849 errors / optimizations#1886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
raheeliftikhar5 merged 6 commits intolowcoder-org:devfromiamfaran:fix/1849-errors
Jul 22, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -189,6 +189,7 @@ export function codeControl<
const cardContent = params.disableCard
? ""
: getCardContent(this.unevaledValue, this.valueAndMsg, codeControlParams);
const { key, ...restParams } = params;
return (
<EditorContext.Consumer>
{(editorState) => (
Expand All@@ -197,7 +198,8 @@ export function codeControl<
<>
<Suspense fallback={null}>
<CodeEditor
{...params}
key={key}
{...restParams}
bordered
value={this.unevaledValue}
codeType={codeType}
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
import { useDispatch, useSelector } from "react-redux";
import { useParams } from "react-router-dom";
import { HomeBreadcrumbType, HomeLayout } from "./HomeLayout";
import {useEffect, useState} from "react";
import { useEffect, useState } from "react";
import { useDebouncedValue } from "util/hooks";
import {ApplicationCategoriesEnum, ApplicationMeta, FolderMeta} from "../../constants/applicationConstants";
import { buildFolderUrl } from "../../constants/routesURL";
import { folderElementsSelector, foldersSelector } from "../../redux/selectors/folderSelector";
Expand DownExpand Up@@ -100,13 +101,12 @@ export function FolderView() {
}, [searchValues]
);

useEffect(()=> {
const timer = setTimeout(() => {
if (searchValue.length > 2 || searchValue === "")
setSearchValues(searchValue)
}, 500);
return () => clearTimeout(timer);
}, [searchValue])
const debouncedSearchValue = useDebouncedValue(searchValue, 500);

useEffect(() => {
if (debouncedSearchValue.trim().length > 0 || debouncedSearchValue === "")
setSearchValues(debouncedSearchValue);
}, [debouncedSearchValue]);

return (
<>
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,8 @@ import { HomeLayout } from "./HomeLayout";
import { getUser } from "../../redux/selectors/usersSelectors";
import { Helmet } from "react-helmet";
import { trans } from "i18n";
import {useState, useEffect } from "react";
import { useState, useEffect } from "react";
import { useDebouncedValue } from "util/hooks";
import {fetchFolderElements} from "@lowcoder-ee/util/pagination/axios";
import {ApplicationCategoriesEnum, ApplicationMeta, FolderMeta} from "@lowcoder-ee/constants/applicationConstants";
import {ApplicationPaginationType} from "@lowcoder-ee/util/pagination/type";
Expand DownExpand Up@@ -53,13 +54,13 @@ export function HomeView() {
}, [searchValues]
);

useEffect(()=> {
const timer = setTimeout(() => {
if (searchValue.length > 2 || searchValue === "")
setSearchValues(searchValue)
}, 500);
return () => clearTimeout(timer);
}, [searchValue])
const debouncedSearchValue = useDebouncedValue(searchValue, 500);

useEffect(() => {
if (debouncedSearchValue.trim().length > 0 || debouncedSearchValue === "") {
setSearchValues(debouncedSearchValue);
}
}, [debouncedSearchValue]);

const user = useSelector(getUser);

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
import { HomeLayout } from "./HomeLayout";
import { TRASH_URL } from "../../constants/routesURL";
import {useEffect, useState} from "react";
import { useEffect, useState } from "react";
import { useDebouncedValue } from "util/hooks";
import { trans } from "../../i18n";
import { Helmet } from "react-helmet";
import {fetchApplicationElements} from "@lowcoder-ee/util/pagination/axios";
Expand DownExpand Up@@ -46,14 +47,13 @@ export function TrashView() {
}, [searchValues]
);

//debouncing
useEffect(()=> {
const timer = setTimeout(() => {
if (searchValue.length > 2 || searchValue === "")
setSearchValues(searchValue)
}, 500);
return () => clearTimeout(timer);
}, [searchValue])
const debouncedSearchValue = useDebouncedValue(searchValue, 500);

useEffect(() => {
if (debouncedSearchValue.trim().length > 0 || debouncedSearchValue === "") {
setSearchValues(debouncedSearchValue);
}
}, [debouncedSearchValue]);

return (
<>
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -176,6 +176,7 @@ export default function ApplicationHome() {
routePath: ALL_APPLICATIONS_URL,
routeComp: HomeView,
icon: ({ selected, ...otherProps }) => selected ? <AppsIcon {...otherProps} width={"24px"}/> : <AppsIcon {...otherProps} width={"24px"}/>,
onSelected: (_, currentPath) => currentPath === ALL_APPLICATIONS_URL || currentPath.startsWith("/folder"),
},
],
},
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
import styled from "styled-components";
import { EditPopover, PointIcon, Search, TacoButton } from "lowcoder-design";
import {useEffect, useState} from "react";
import { useState, useEffect } from "react";
import { useDebouncedValue } from "util/hooks";
import { useDispatch, useSelector } from "react-redux";
import { getDataSourceTypesMap } from "../../redux/selectors/datasourceSelectors";
import { deleteDatasource } from "../../redux/reduxActions/datasourceActions";
Expand DownExpand Up@@ -124,13 +125,13 @@ export const DatasourceList = () => {
const [pageSize, setPageSize] = useState(10);
const [paginationLoading, setPaginationLoading] = useState(false);

useEffect(()=> {
const timer = setTimeout(() => {
if (searchValue.length > 2 || searchValue === "")
setSearchValues(searchValue)
}, 500);
return () => clearTimeout(timer);
}, [searchValue])
const debouncedSearchValue = useDebouncedValue(searchValue, 500);

useEffect(() => {
if (debouncedSearchValue.trim().length > 0 || debouncedSearchValue === "") {
setSearchValues(debouncedSearchValue);
}
}, [debouncedSearchValue]);

useEffect( () => {
setPaginationLoading(true);
Expand Down
16 changes: 8 additions & 8 deletionsclient/packages/lowcoder/src/pages/queryLibrary/LeftNav.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
import {useEffect, useState} from "react";
import { useEffect, useState } from "react";
import { useDebouncedValue } from "util/hooks";
import styled, { css } from "styled-components";
import {
BluePlusIcon,
Expand DownExpand Up@@ -174,14 +175,13 @@ export const LeftNav = (props: {
const [searchValue, setSearchValue] = useState("");
const datasourceTypes = useSelector(getDataSourceTypesMap);

useEffect(()=> {
const timer = setTimeout(() => {
if (searchValue.length > 2 || searchValue === "")
setSearchValues(searchValue)
}, 500);
return () => clearTimeout(timer);
}, [searchValue])
const debouncedSearchValue = useDebouncedValue(searchValue, 500);

useEffect(() => {
if (debouncedSearchValue.trim().length > 0 || debouncedSearchValue === "") {
setSearchValues(debouncedSearchValue);
}
}, [debouncedSearchValue]);


return (
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,9 +96,18 @@ export function AdvancedSetting() {
}, [currentUser.currentOrgId])

useEffect(() => {
dispatch(fetchCommonSettings({ orgId: currentUser.currentOrgId }));
dispatch(fetchAllApplications({}));
}, [currentUser.currentOrgId, dispatch]);
// Only fetch common settings if not already loaded
if (Object.keys(commonSettings).length === 0) {
dispatch(fetchCommonSettings({ orgId: currentUser.currentOrgId }));
}
}, [currentUser.currentOrgId, dispatch, commonSettings]);

// Lazy load applications only when dropdown is opened
const handleDropdownOpen = () => {
if (appList.length === 0) {
dispatch(fetchAllApplications({}));
}
};

useEffect(() => {
setSettings(commonSettings);
Expand All@@ -110,9 +119,7 @@ export function AdvancedSetting() {
}
}, [canLeave]);

useEffect(() => {
dispatch(fetchCommonSettings({ orgId: currentUser.currentOrgId }));
}, [currentUser.currentOrgId, dispatch]);


const handleSave = (key: keyof typeof settings, onSuccess?: () => void) => {
return (value?: any) => {
Expand DownExpand Up@@ -178,6 +185,9 @@ export function AdvancedSetting() {
onChange={(value: string) => {
setSettings((v) => ({ ...v, defaultHomePage: value }));
}}
onDropdownVisibleChange={(open) => {
if (open) handleDropdownOpen();
}}
options={appListOptions}
filterOption={(input, option) => (option?.label as string).includes(input)}
/>
Expand Down
19 changes: 19 additions & 0 deletionsclient/packages/lowcoder/src/util/hooks.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,6 +29,7 @@ import { constantColors } from "components/colorSelect/colorUtils";
import { AppState } from "@lowcoder-ee/redux/reducers";
import { getOrgUserStats } from "@lowcoder-ee/redux/selectors/orgSelectors";
import { fetchGroupsAction } from "@lowcoder-ee/redux/reduxActions/orgActions";
import debounce from "lodash/debounce";

export const ForceViewModeContext = React.createContext<boolean>(false);

Expand DownExpand Up@@ -282,3 +283,21 @@ export const useOrgUserCount = (orgId: string) => {

return userCount;
};

/**
* Returns a debounced version of the incoming value that only updates
*/
export function useDebouncedValue<T>(value: T, delay = 500): T {
const [debouncedValue, setDebouncedValue] = useState<T>(value);

const updater = useMemo(() => debounce(setDebouncedValue, delay), [delay]);

useEffect(() => {
updater(value);
return () => {
updater.cancel();
};
}, [value, updater]);

return debouncedValue;
}
Loading

[8]ページ先頭

©2009-2025 Movatter.jp