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

Async event emitters between front/back-end #138

Open
1 task
misterjoecool opened this issue Jun 7, 2024 · 0 comments
Open
1 task

Async event emitters between front/back-end #138

misterjoecool opened this issue Jun 7, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@misterjoecool
Copy link
Contributor

Problem

Sub-issue #1: Currently, the way the feedback modal works is by handling events that are emitted from both the frontend and the backend.

Sub-issue #2: The main roadblock in the way of finalizing the transfer of event handlers out of the frontend is the way the dblist (list of databases in the sidebar) gets updated. Many event handlers in the backend send a dblist update event out to update the front end.

Sub-issue #3: There are still some filesystem read/write calls in the front end.

Solution

Sub-issue #1: Ideally, this should be refactored to be state dependent rather than event dependent, as it controls the display of the modal. This can be tied into the centralized async event emitter added to frontend/components/app.tsx, in conjunction with migration to reducers from state variables. The goal will be to house modal messages in the store tied to the main app reducer. From there, the async handler can send new messages to the state via main app dispatch, and any other front end feedback can do the same.

Sub-issue #2: Ideally, this should be handled by returning the new dblist changes out of the handler and using that resolved value to update state whenever an action would cause a dblist change. Right now, app.tsx has a useEffect running that listens for those dblist updates every frame. This is inefficient as a frontend concern.

Sub-issue #3: This should be refactored to an async call that requests the backend handle the file system read/write for proper separation of concerns.

Additional information

The spinner currently works in a similar way to feedback. Once all async is completely migrated (including dblist update changes), this spinner can simply be tied to the loading property in the main app state.

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd love to make a PR to implement this feature!
@misterjoecool misterjoecool added the enhancement New feature or request label Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant