#Im going to open a thread so we dont
1 messages ยท Page 1 of 1 (latest)
If you want to 'save' your queries somewhere, save it in state... on the file system. If you want it to be cross device you need to store it on the backend.
Okay so here is the issue, i dont want to save them
BUT
i want a way to save the state of the query, abd the data returned in nextjs
because these are stuff you dont need to save
specially the data itself, you can export to csv at that point
I mean its still the same answer.
save the state into a file.
You want to save the state after navigations and re-renders right?
save it to a file, pick a schema, pick json, ini, endless possibilities
But is that necessarily efficient
I would not use zustand or tsq.
Its the most simple, and efficient way to do it. A library is going to cost more than reading and writing to a local file
if your plan is to be on device only.
but also... again.... you shouldnt use nextjs. it isnt supported in electron apps
it works, but there are issues.
weird issues, your not going to get much help with
ive tried lol
Well lets say my query returns an array of 15k records
Mhmmmm.
what would you then?
You dont need to save it in the system, because the user can look at this query for 1 sec and be like nahh i dont need this
so this is all temporary kinda
You either need backend pagination, or you display it on the front end. I regularly fetch and display 100k records.
easily
virtual pagination
so as he scrolles, i get more and more ?
Alright, so im sending ove3r another diagram
So. in my opinion.
Tree view, should be the master component.
that takes up the page.
With the sql query editor and query results within it.
query editor and results dont need to share state.
https://react-querybuilder.js.org/
You should also take a look at this, its really need I use this in production at work
so can you hop on a call so i can understand better ?
I cant, im at work lol
lmao
well not 'at work' but in a work call
i see
okay can you go on with your opinions ?
|-- /src
| |-- /components
| | |-- Header.js
| | |-- Sidebar.js
| | |-- DatabaseList.js
| | |-- TableView.js
| | |-- QueryRunner.js
| | |-- ...other components
| |
| |-- /pages
| | |-- index.js
| | |-- databases.js
| | |-- queries.js
| |
| |-- /state
| | |-- useDatabaseStore.js
| | |-- useQueryStore.js
i was thinkign something like this but tsx
aight
export default function Home() {
const [db, setDb] = useState(null);
const setDb = (database) => {
setDb(database);
}
return (
<Layout>
<DBExplorer setter={setDb} database={db}>
Tree view here
</DBExplorer>
<QueryEditor database={db} >
<QueryResults />
</QueryEditor>
</Layout>
);
}
this is rough
but db is the only thing you need to share between dbexplorer and query editor
so you share it by hoisting the state to the parent
and exposing the setter to the db explorer and value to the editor
The db is shared by default, since i can call it from wherever i want i nmy app
Sure, is your setter shared?
Its coming through some custom invoke code
right but thats whats populating the tree view right?
This is an example
Oh goodness lol
๐
What your doing isnt a bad way to do it I guess. lol but its different than I would do it
Its the way i can access the backend in tauri
I gotcha, im not familiar with it really
i see
rn, i turn it into a fixed model just to get something to displayt
this was done in like 2 hours so
But regardless. you really need to store the data 'globally' for the page
Its still verrry early
You mean the db tree ?
If your not in a rush I can help you out more after work.
Like work up something a little more concise
Did you look at that react query builder library? I think its perfect for something like this.
Where you from? Just curious
Middle east
US, florida to be specific
2 more hours till work is done, but ill be up till like 2-3 am its friday lol
so if your going to bed its all good
nah
ill add you so we can take to dms
Database management, software and web developement
Okay so you know what your doing, not trying to peice this together from nothing
which isnt a bad thing, it just changes how ill explain things
kk yeah after im done with this meeting ill get something together to better show what I mean
But its my first big nextjs project, so i need someone to roughly guide me
honestly you should treat this as a react project and not worry about the nuances of nextjs until they are relevant.
Sure, ill show you everything until then
yeah i dont really use react at work, so i dont know the best practices there either
Gotcha, thats important for me to know ๐
np accdept my friend request
i can give you a deeper overview of the project
sure thing
or you can open a help forum thread, thats technically where it should go ๐
but idk how much you want to share publicly
honestly prefer one person helping, and i dont like to share too much of the code rn
been in too many situations where the people trying to help me themselves cannot agree on a common gtround
yessir
Well... theres no one way to do something
im open to have someone on board as a developer in case you liked the idae
Meh, maybe. We will see, its interesting for now xD I have a job hahah