-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix brief page not found while accessing plug page #16452
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -13,7 +13,12 @@ export type CareAppsContextType = Array< | |||||||||||||||||
| (({ isLoading: false } & PluginManifestWithMeta) | { isLoading: true }) | ||||||||||||||||||
| >; | ||||||||||||||||||
|
|
||||||||||||||||||
| export const CareAppsContext = createContext<CareAppsContextType | null>(null); | ||||||||||||||||||
| export type CareAppsContextValue = { | ||||||||||||||||||
| apps: CareAppsContextType; | ||||||||||||||||||
| isLoading: boolean; | ||||||||||||||||||
| }; | ||||||||||||||||||
|
Comment on lines
+16
to
+19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win Use Per coding guidelines, prefer Suggested fix-export type CareAppsContextValue = {
- apps: CareAppsContextType;
- isLoading: boolean;
-};
+export interface CareAppsContextValue {
+ apps: CareAppsContextType;
+ isLoading: boolean;
+}📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsSource: Coding guidelines |
||||||||||||||||||
|
|
||||||||||||||||||
| export const CareAppsContext = createContext<CareAppsContextValue | null>(null); | ||||||||||||||||||
|
|
||||||||||||||||||
| export const useCareApps = () => { | ||||||||||||||||||
| const ctx = useContext(CareAppsContext); | ||||||||||||||||||
|
|
@@ -22,9 +27,12 @@ export const useCareApps = () => { | |||||||||||||||||
| "'useCareApps' must be used within 'CareAppsProvider' only", | ||||||||||||||||||
| ); | ||||||||||||||||||
| } | ||||||||||||||||||
| return ctx; | ||||||||||||||||||
| return ctx.apps; | ||||||||||||||||||
| }; | ||||||||||||||||||
|
|
||||||||||||||||||
| export const useCareAppsLoading = () => | ||||||||||||||||||
| useContext(CareAppsContext)?.isLoading ?? false; | ||||||||||||||||||
|
|
||||||||||||||||||
| // export const useCareAppNavItems = () => { | ||||||||||||||||||
| // const careApps = useCareApps(); | ||||||||||||||||||
| // const navItems = careApps.reduce<INavItem[]>((acc, plugin) => { | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial | ⚡ Quick win
Memoize the context value to prevent unnecessary re-renders.
The inline object
{ apps: pluginsQuery, isLoading: arePluginsLoading }creates a new reference on every render, which can trigger re-renders in all context consumers even when the actual data hasn't changed.Suggested fix
Note:
useMemois already imported on line 13.🤖 Prompt for AI Agents