Skip to content

Commit

Permalink
fix(dynamic-table): search form schema should not be reset after tabl…
Browse files Browse the repository at this point in the history
…e reload
  • Loading branch information
buqiyuan committed Mar 28, 2024
1 parent ded54f8 commit 4b2833a
Show file tree
Hide file tree
Showing 13 changed files with 216 additions and 262 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ yarn-error.log*
types/auto-imports.d.ts
types/components.d.ts

packages/vite-plugin-http2-proxy
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
},
"devDependencies": {
"@admin-pkg/components": "workspace:*",
"@admin-pkg/vite-plugin-http2-proxy": "workspace:^",
"@admin-pkg/vite-plugin-msw": "workspace:*",
"@admin-pkg/vite-plugin-tinymce-resource": "workspace:*",
"@commitlint/cli": "~19.2.1",
Expand Down Expand Up @@ -101,23 +102,22 @@
"husky": "~9.0.11",
"less": "~4.2.0",
"lint-staged": "~15.2.2",
"msw": "^2.2.10",
"msw": "^2.2.13",
"nx": "^18.1.3",
"postcss": "~8.4.38",
"postcss-html": "~1.6.0",
"postcss-less": "~6.0.0",
"prettier": "~3.2.5",
"pretty-quick": "~4.0.0",
"rimraf": "~5.0.5",
"stylelint": "~16.3.0",
"stylelint": "~16.3.1",
"stylelint-config-property-sort-order-smacss": "^10.0.0",
"stylelint-config-recommended": "~14.0.0",
"stylelint-config-recommended-vue": "~1.5.0",
"stylelint-config-standard": "~36.0.0",
"stylelint-order": "~6.0.4",
"stylelint-prettier": "^5.0.0",
"typescript": "~5.4.3",
"unocss": "^0.58.6",
"unocss": "^0.58.8",
"unplugin-vue-components": "~0.26.0",
"vite": "~5.2.6",
"vite-plugin-checker": "~0.6.4",
Expand All @@ -144,7 +144,7 @@
],
"license": "MIT",
"target": "web",
"dependenciesMeta": {
"devDependenciesMeta": {
"@admin-pkg/vite-plugin-msw": {
"injected": true
},
Expand Down
6 changes: 3 additions & 3 deletions packages/vite-plugin-msw/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@
"registry": "https://registry.npmjs.org/"
},
"dependencies": {
"@mswjs/interceptors": "^0.26.5",
"headers-polyfill": "^4.0.2",
"@mswjs/interceptors": "^0.26.14",
"headers-polyfill": "^4.0.3",
"strict-event-emitter": "^0.5.1"
},
"devDependencies": {
"tsup": "^8.0.2"
},
"peerDependencies": {
"msw": "^2.0.0"
"msw": "^2.2.13"
}
}
2 changes: 1 addition & 1 deletion packages/vite-plugin-msw/src/browser/vitePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const localMswDistPath = resolve(__dirname, swFileName);
export const createBrowserMiddleware = (): Connect.NextHandleFunction => {
return async (req, res, next) => {
try {
if (req.method !== 'GET' || req.url !== `/${swFileName}`) {
if (req.method !== 'GET' || !req.url?.includes(`/${swFileName}`)) {
next();
return;
}
Expand Down
11 changes: 5 additions & 6 deletions packages/vite-plugin-msw/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createNodeMiddleware } from './node/';
import { buildMswForBrowser, createBrowserMiddleware } from './browser/vitePlugin';
import type { HttpHandler } from 'msw';
import type { Plugin } from 'vite';
import type { PluginOption } from 'vite';

export interface VitePluginMswOptions {
mode?: 'browser' | 'node';
Expand All @@ -13,7 +13,7 @@ interface BrowserIntegrationOptions {
build?: boolean;
}

const browserIntegration = ({ build }: BrowserIntegrationOptions): Plugin => {
const browserIntegration = ({ build }: BrowserIntegrationOptions): PluginOption => {
let outDir;
return {
name: 'vite-plugin-msw:browser-integration',
Expand All @@ -35,7 +35,7 @@ const browserIntegration = ({ build }: BrowserIntegrationOptions): Plugin => {
};
};

const getNodeIntegration = (handlers: HttpHandler[]): Plugin => {
const getNodeIntegration = (handlers: HttpHandler[]): PluginOption => {
return {
name: 'vite-plugin-msw:node-integration',
configureServer(devServer) {
Expand All @@ -46,9 +46,8 @@ const getNodeIntegration = (handlers: HttpHandler[]): Plugin => {

function vitePluginMsw(
options: Omit<VitePluginMswOptions, 'handlers'> & { mode?: 'browser' },
): Plugin;
function vitePluginMsw(options: VitePluginMswOptions & { mode?: 'node' }): Plugin;
function vitePluginMsw(options: VitePluginMswOptions): Plugin {
): PluginOption;
function vitePluginMsw(options: VitePluginMswOptions): PluginOption {
const { mode = 'browser', handlers = [], build = false } = options;
if (mode === 'node') {
return getNodeIntegration(handlers);
Expand Down
Loading

0 comments on commit 4b2833a

Please sign in to comment.