-
Notifications
You must be signed in to change notification settings - Fork 364
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
Feat: [M3-7195] - Marketplace OCA loading pattern POC #9724
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a6014ad
Initial commit
abailly-akamai 410d48f
Fix stackscripts prefetching
abailly-akamai 1ce7884
Revert "Fix stackscripts prefetching"
abailly-akamai 10d90f3
Fix stackscripts prefetching
abailly-akamai 8d39f4d
Add test and clear function
abailly-akamai 91c2f91
Cleanup and comments
abailly-akamai 7b70c9d
Added changeset: Improve loading patterns on Marketplace page
abailly-akamai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-9724-tech-stories-1695847434977.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Tech Stories | ||
--- | ||
|
||
Improve loading patterns on Marketplace page ([#9724](https://github.com/linode/manager/pull/9724)) |
51 changes: 51 additions & 0 deletions
51
packages/manager/src/features/Linodes/LinodesCreate/LoadingAppPanelSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import Grid from '@mui/material/Unstable_Grid2'; | ||
import { styled } from '@mui/material/styles'; | ||
import { useTheme } from '@mui/material/styles'; | ||
import useMediaQuery from '@mui/material/useMediaQuery'; | ||
import * as React from 'react'; | ||
|
||
import { Divider } from 'src/components/Divider'; | ||
import { Skeleton } from 'src/components/Skeleton'; | ||
import { Typography } from 'src/components/Typography'; | ||
|
||
interface Props { | ||
desktopCount: number; | ||
heading: string; | ||
mobileCount: number; | ||
} | ||
|
||
export const LoadingAppPanelSection = (props: Props) => { | ||
const { desktopCount, heading, mobileCount } = props; | ||
const theme = useTheme(); | ||
const matchesSmDown = useMediaQuery(theme.breakpoints.down('md')); | ||
const count = matchesSmDown ? mobileCount : desktopCount; | ||
|
||
return ( | ||
<> | ||
<Typography variant="h2">{heading}</Typography> | ||
<Divider spacingBottom={16} spacingTop={16} /> | ||
<AppPanelGrid container spacing={2}> | ||
{Array(count) | ||
.fill(0) | ||
.map((_, idx) => ( | ||
<Grid key={idx} md={4} sm={6} xs={12}> | ||
<StyledSkeleton /> | ||
</Grid> | ||
))} | ||
</AppPanelGrid> | ||
</> | ||
); | ||
}; | ||
|
||
const AppPanelGrid = styled(Grid)(({ theme }) => ({ | ||
marginBottom: theme.spacing(), | ||
marginTop: theme.spacing(2), | ||
padding: `${theme.spacing(1)} 0`, | ||
})); | ||
|
||
const StyledSkeleton = styled(Skeleton, { | ||
label: 'StyledSkeleton', | ||
})(({ theme }) => ({ | ||
height: 60, | ||
transform: 'none', | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ export const queryKey = 'stackscripts'; | |
|
||
export const useStackScriptsOCA = (enabled: boolean, params: Params = {}) => { | ||
return useQuery<StackScript[], APIError[]>( | ||
[`${queryKey}-oca-all`, params], | ||
`${queryKey}-oca-all`, | ||
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. This is the fix for the prefetching request being invalidated. on page visit. CC @bnussman |
||
() => getAllOCAsRequest(params), | ||
{ | ||
enabled, | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Refactored the markup a little bit and no need for styled components for a couple css rules.