-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix: File watcher isn't initialized on start-up #398
base: main
Are you sure you want to change the base?
Conversation
8b26276
to
0a67a00
Compare
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.
Self-review
} | ||
|
||
function useFolderContent() { | ||
const recordings = useStudioUIStore((s) => orderByFileName(s.recordings)) | ||
const generators = useStudioUIStore((s) => orderByFileName(s.generators)) | ||
const scripts = useStudioUIStore((s) => orderByFileName(s.scripts)) | ||
const data = useStudioUIStore((s) => orderByFileName(s.data)) |
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.
Perhaps data
is too vague?
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.
I'm leaning towards a yes, maybe we should be explicit and call it testData
?
const file = getStudioFileFromPath(filePath) | ||
|
||
if (!file) { | ||
return | ||
} |
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.
Previously, you could add an arbitrary file to one of the watched folders and ui:add-file
would still be fired
} | ||
}), | ||
removeFile: (path) => | ||
removeFile: (file) => | ||
set((state) => { |
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.
It now seems to me that it'd better to store all files in a flat map and get recordings
, generators,
scripts`, etc. using a zustand selector
return fileName.endsWith('.har') | ||
} | ||
|
||
export function isGenerator(fileName: string) { |
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.
With the addition of test data, this is no longer accurate. Instead, we get StudioFile
objects from the main process, so we can always check the type directly
export const scriptExists = async (fileName: string) => { | ||
return window.studio.ui | ||
.getFiles() | ||
.then((files) => files.scripts.includes(fileName)) | ||
} |
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.
This is not needed, because we always have the current list of files in the ui store
@@ -82,7 +82,7 @@ | |||
"@tanstack/react-query": "^5.55.4", | |||
"@vitejs/plugin-react": "^4.3.1", | |||
"allotment": "^1.20.2", | |||
"chokidar": "^3.6.0", | |||
"chokidar": "^4.0.3", |
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.
Sep 2024 update: v4 is out! It decreases dependency count from 13 to 1, removes support for globs, adds support for ESM / Common.js modules, and bumps minimum node.js version from v8 to v14. Check out upgrading.
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.
LGTM!
} | ||
|
||
function useFolderContent() { | ||
const recordings = useStudioUIStore((s) => orderByFileName(s.recordings)) | ||
const generators = useStudioUIStore((s) => orderByFileName(s.generators)) | ||
const scripts = useStudioUIStore((s) => orderByFileName(s.scripts)) | ||
const data = useStudioUIStore((s) => orderByFileName(s.data)) |
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.
I'm leaning towards a yes, maybe we should be explicit and call it testData
?
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.
LGTM! I agree with renaming instances of data
to test data
.
@@ -5,3 +5,4 @@ export const PROJECT_PATH = path.join(app.getPath('documents'), 'k6-studio') | |||
export const RECORDINGS_PATH = path.join(PROJECT_PATH, 'Recordings') | |||
export const GENERATORS_PATH = path.join(PROJECT_PATH, 'Generators') | |||
export const SCRIPTS_PATH = path.join(PROJECT_PATH, 'Scripts') | |||
export const DATA_PATH = path.join(PROJECT_PATH, 'Data') |
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.
Perhaps the directory name should also be Test Data
?
@Llandy3d @cristianoventura re: data/test data name - I've been meaning to ask product about this, will update the PR after I get an answer |
75dcb0f
7d70e55
to
75dcb0f
Compare
Description
How to Test
Fix for file watcher:
Groundwork for data files support:
Data
folder has been created in the studio workspace folderSidebar.tsx
const { recordings, generators, scripts, data } = useFiles(searchTerm)
FileTree
for data files:Checklist
npm run lint
) and all checks pass.npm test
) and all tests pass.