Skip to content
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

[docs] Remove redundant encoding in the mock data source server #14185

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 3 additions & 5 deletions docs/data/data-grid/server-side-data/ServerSideDataGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ function ServerSideDataGrid() {
() => ({
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: encodeURIComponent(
JSON.stringify(params.paginationModel),
),
filterModel: encodeURIComponent(JSON.stringify(params.filterModel)),
sortModel: encodeURIComponent(JSON.stringify(params.sortModel)),
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
Expand Down
8 changes: 3 additions & 5 deletions docs/data/data-grid/server-side-data/ServerSideDataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ function ServerSideDataGrid() {
() => ({
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: encodeURIComponent(
JSON.stringify(params.paginationModel),
),
filterModel: encodeURIComponent(JSON.stringify(params.filterModel)),
sortModel: encodeURIComponent(JSON.stringify(params.sortModel)),
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ export default function ServerSideDataGridNoCache() {
() => ({
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: encodeURIComponent(
JSON.stringify(params.paginationModel),
),
filterModel: encodeURIComponent(JSON.stringify(params.filterModel)),
sortModel: encodeURIComponent(JSON.stringify(params.sortModel)),
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ export default function ServerSideDataGridNoCache() {
() => ({
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: encodeURIComponent(
JSON.stringify(params.paginationModel),
),
filterModel: encodeURIComponent(JSON.stringify(params.filterModel)),
sortModel: encodeURIComponent(JSON.stringify(params.sortModel)),
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
Expand Down
8 changes: 3 additions & 5 deletions docs/data/data-grid/server-side-data/ServerSideDataGridTTL.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ function ServerSideDataGridTTL() {
() => ({
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: encodeURIComponent(
JSON.stringify(params.paginationModel),
),
filterModel: encodeURIComponent(JSON.stringify(params.filterModel)),
sortModel: encodeURIComponent(JSON.stringify(params.sortModel)),
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ function ServerSideDataGridTTL() {
() => ({
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: encodeURIComponent(
JSON.stringify(params.paginationModel),
),
filterModel: encodeURIComponent(JSON.stringify(params.filterModel)),
sortModel: encodeURIComponent(JSON.stringify(params.sortModel)),
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ export default function ServerSideErrorHandling() {
() => ({
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: encodeURIComponent(
JSON.stringify(params.paginationModel),
),
filterModel: encodeURIComponent(JSON.stringify(params.filterModel)),
sortModel: encodeURIComponent(JSON.stringify(params.sortModel)),
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,9 @@ export default function ServerSideErrorHandling() {
() => ({
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: encodeURIComponent(
JSON.stringify(params.paginationModel),
),
filterModel: encodeURIComponent(JSON.stringify(params.filterModel)),
sortModel: encodeURIComponent(JSON.stringify(params.sortModel)),
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
Expand Down
10 changes: 4 additions & 6 deletions docs/data/data-grid/server-side-data/ServerSideTreeData.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ export default function ServerSideTreeData() {
() => ({
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: encodeURIComponent(
JSON.stringify(params.paginationModel),
),
filterModel: encodeURIComponent(JSON.stringify(params.filterModel)),
sortModel: encodeURIComponent(JSON.stringify(params.sortModel)),
groupKeys: encodeURIComponent(JSON.stringify(params.groupKeys)),
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
groupKeys: JSON.stringify(params.groupKeys),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
Expand Down
10 changes: 4 additions & 6 deletions docs/data/data-grid/server-side-data/ServerSideTreeData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ export default function ServerSideTreeData() {
() => ({
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: encodeURIComponent(
JSON.stringify(params.paginationModel),
),
filterModel: encodeURIComponent(JSON.stringify(params.filterModel)),
sortModel: encodeURIComponent(JSON.stringify(params.sortModel)),
groupKeys: encodeURIComponent(JSON.stringify(params.groupKeys)),
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
groupKeys: JSON.stringify(params.groupKeys),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,10 @@ export default function ServerSideTreeDataCustomCache() {
() => ({
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: encodeURIComponent(
JSON.stringify(params.paginationModel),
),
filterModel: encodeURIComponent(JSON.stringify(params.filterModel)),
sortModel: encodeURIComponent(JSON.stringify(params.sortModel)),
groupKeys: encodeURIComponent(JSON.stringify(params.groupKeys)),
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
groupKeys: JSON.stringify(params.groupKeys),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@ export default function ServerSideTreeDataCustomCache() {
() => ({
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: encodeURIComponent(
JSON.stringify(params.paginationModel),
),
filterModel: encodeURIComponent(JSON.stringify(params.filterModel)),
sortModel: encodeURIComponent(JSON.stringify(params.sortModel)),
groupKeys: encodeURIComponent(JSON.stringify(params.groupKeys)),
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
groupKeys: JSON.stringify(params.groupKeys),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ export default function ServerSideTreeDataErrorHandling() {
() => ({
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: encodeURIComponent(
JSON.stringify(params.paginationModel),
),
filterModel: encodeURIComponent(JSON.stringify(params.filterModel)),
sortModel: encodeURIComponent(JSON.stringify(params.sortModel)),
groupKeys: encodeURIComponent(JSON.stringify(params.groupKeys)),
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
groupKeys: JSON.stringify(params.groupKeys),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@ export default function ServerSideTreeDataErrorHandling() {
() => ({
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: encodeURIComponent(
JSON.stringify(params.paginationModel),
),
filterModel: encodeURIComponent(JSON.stringify(params.filterModel)),
sortModel: encodeURIComponent(JSON.stringify(params.sortModel)),
groupKeys: encodeURIComponent(JSON.stringify(params.groupKeys)),
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
groupKeys: JSON.stringify(params.groupKeys),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ export default function ServerSideTreeDataGroupExpansion() {
() => ({
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: encodeURIComponent(
JSON.stringify(params.paginationModel),
),
filterModel: encodeURIComponent(JSON.stringify(params.filterModel)),
sortModel: encodeURIComponent(JSON.stringify(params.sortModel)),
groupKeys: encodeURIComponent(JSON.stringify(params.groupKeys)),
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
groupKeys: JSON.stringify(params.groupKeys),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ export default function ServerSideTreeDataGroupExpansion() {
() => ({
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: encodeURIComponent(
JSON.stringify(params.paginationModel),
),
filterModel: encodeURIComponent(JSON.stringify(params.filterModel)),
sortModel: encodeURIComponent(JSON.stringify(params.sortModel)),
groupKeys: encodeURIComponent(JSON.stringify(params.groupKeys)),
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
groupKeys: JSON.stringify(params.groupKeys),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
Expand Down
2 changes: 1 addition & 1 deletion packages/x-data-grid-generator/src/hooks/useMockServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function decodeParams(url: string): GridGetRowsParams {

for (const [key, value] of array) {
try {
decodedParams[key] = JSON.parse(decodeURIComponent(value));
decodedParams[key] = JSON.parse(value);
MBilalShafi marked this conversation as resolved.
Show resolved Hide resolved
} catch (e) {
decodedParams[key] = value;
}
Expand Down
Loading