Oh wow, sometimes things can be so simple
Never occured to me.
If notes donāt live alone and belong to the context of a task (perhaps) you can also consider joining notes to tasks as you join tasks to workspaces
You know, thinking more about the MongoDB structure we talked about (about not having embedded documents), Iām not so sure it makes a huge performance difference. Isnāt it worse to have references pointing to different collections, since you now have to make multiple successive DB hits to fetch data (rather than one atomic query)? Not to mention thereās no transactions in Mongo, so you have to implement your own home-grown rollback system in case an update fails.
Update #4
Thanks to your advice. Helped a lot.
Since the concept of joining collections is completely new to me I went with Sanjoās approach.
So now the data model looks like this:
Moving from two collections (notes & tasks) to only one (entries) ment rewriting quite a few things.
This made me realize how important it is to have a solid data model before you even start coding.
Changes
- Got rid of the notes & tasks collections
- Added the entries collection
- Added chronological order of tasks and notes
- Successfully corrected the feature to only show the input-field when a workstream is selected. (Thanks to Sanjo for the tip)
App-Status
Hereās the current Version:
http://workstreams_v4.meteor.com/
(Tested in Chrome only)
Whatās next?
- User Accounts
Only played with the standard āaccountsā packages so far.
Building a customized login will be new to me. Probably taking a closer look at the āuseraccountsā packages for that. - Cleaning things up (css-stuff) + removing the insecure & autopublish packages.
Heew⦠this should be fun.
Big thanks
Overall many thanks to all the advice from you guys.
I know itās a small & simple app, but Iām quite happy to see it coming together now
I think task and note should be seen as subclasses of entry. I wonder why you needed to rewrite so much. The data model didnāt really change much.
I guess in hindsight youāre right. It just still felt uncomfortable to me to touch code that I already got running.
Iām working on the next update and things are coming along fine.
Question
To this I couldnāt find a solution:
When I have a lot of entries attached to a stream, there is a delay when I want to display/render them.
Itās probably easier to understand, when you experience it yourself:
http://workstreams_v5.meteor.com/
Username: admin
Password: admin1234
Iāve set up 4 streams with 10, 25, 50 and 100+ entries attached to them.
- As you can see up to 50 entries render reasonably fast.
- But when you click on the stream with 100+ entries, there is a delay of some seconds.
Is there a way around that?
Also I dont really understand why this should be happening.
All the entries are already there on the client, stored in minimongo, right? So why the delay?
Also:
There seems to be a tiny delay for any action. (e.g. checking of tasks)
Itās not much, but a little bit slower than when I work locally.
Is that normal?
My understanding was, that changes (e.g. updates or inserts) should happen instantly on the client and then sync with the server in the background. (Optimistic UI?)
Happy for any kind of help in this.