mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-12 01:24:12 +08:00
🐛 fix(mongodb/query-editor): 修复受限账号连接与不限行数
- MongoDB 指定数据库时保留连接校验并跳过全库枚举 - 允许查询最大行数为 0 并持久化不限设置 - 补充数据库枚举与不限行数持久化回归测试 Refs #741 Refs #752
This commit is contained in:
@@ -314,6 +314,23 @@ describe('store appearance persistence', () => {
|
||||
expect(reloaded.useStore.getState().queryOptions.wordWrap).toBe(true);
|
||||
});
|
||||
|
||||
it('persists zero as the unlimited SQL query row limit', async () => {
|
||||
const { useStore } = await importStore();
|
||||
|
||||
useStore.getState().setQueryOptions({ maxRows: 0 });
|
||||
expect(useStore.getState().queryOptions.maxRows).toBe(0);
|
||||
|
||||
const persisted = JSON.parse(storage.getItem('lite-db-storage') || '{}');
|
||||
expect(persisted.state.queryOptions.maxRows).toBe(0);
|
||||
|
||||
vi.resetModules();
|
||||
const reloaded = await importStore();
|
||||
expect(reloaded.useStore.getState().queryOptions.maxRows).toBe(0);
|
||||
|
||||
reloaded.useStore.getState().setQueryOptions({ maxRows: -1 });
|
||||
expect(reloaded.useStore.getState().queryOptions.maxRows).toBe(5000);
|
||||
});
|
||||
|
||||
it('persists the table overview view mode across store reloads', async () => {
|
||||
const { useStore } = await importStore();
|
||||
expect(useStore.getState().queryOptions.tableOverviewViewMode).toBeUndefined();
|
||||
|
||||
@@ -2794,7 +2794,7 @@ const sanitizeQueryOptions = (value: unknown): QueryOptions => {
|
||||
const queryEditorEditorHeightRatio = sanitizeQueryEditorEditorHeightRatio(
|
||||
raw.queryEditorEditorHeightRatio,
|
||||
);
|
||||
if (!Number.isFinite(maxRows) || maxRows <= 0) {
|
||||
if (!Number.isFinite(maxRows) || maxRows < 0) {
|
||||
return {
|
||||
maxRows: 5000,
|
||||
wordWrap,
|
||||
|
||||
Reference in New Issue
Block a user