Replies: 4 comments
-
I have a lot of sympathy for the underlying ideas and motivations of this proposal. Regarding point 3, my gut feeling is that the proposed Array wrapper would introduce many caveats and solve few problems. I see risks, but not adavantages in using that in place of sorting arrays on the fly before they hit the UI. |
Beta Was this translation helpful? Give feedback.
-
@silviot I completely understand (both the sympathy and restrictions). I was going to suggest some data model changes, but all of those come with some trade offs. As for the Supabase migration...yes it would reduce a lot of headache (at this point I'm discontent with Firebase as much as I am with React, or even more). What I was going to suggest is to definitely aim towards better modularity and composability of our codebase: this can be incremental and has directly to do with some points noted above (1, 3, 4), but also, indirectly it would make it easier to make a switch at some point in the future. My suggestions regarding the incremental modularity (all of these should be doable in complete isolation):
|
Beta Was this translation helpful? Give feedback.
-
Some suggestions for data model changes: I've thought of ditching Additionally, I've thought of merging |
Beta Was this translation helpful? Give feedback.
-
Ok, after much thinking and @silviot's comment on atomicity of firestore updates, I have the following idea: We could refactor the db interactions to not use data triggers at all, but create a db interface where each action does exactly what it's supposed to, nothing more and nothing less. Then we could thoroughly test each interaction and have it be done using The drawback of this would be that we would need to think about how each action affects the entire state (which, it feels, we now have to do ex post, when sourcing the bug) |
Beta Was this translation helpful? Give feedback.
-
I was fixing a minor bug: sorting of customer area calendar slots intraday. The fix was very quick, but when I went to write the tests for the behaviour, it was a nightmare. We have a really complex state setup for some tests (namely data retrieval - redux selectors).
This got me thinking, again, about the complexity of the data model and the data flows.
I don't have a clear solution, but am opening this to discuss possible solutions, as well as when would we have some time to work on this (as it's not really a high-priority feature work).
Some things I'd like integrated:
wrapIter
and the rest), or we could, maybe create a separate repo and publish those as a package (I would call it@code-myriad/toolbox
or something like that)Array
prototype:.add
method (or override the.push
method) so that each time a new item is added, it's.splice
d into the array so that the array is sortedArray.prorotype.findIndex
to find the location where to splice in the new value.findIndex
, which, I think, iterates linearly, or, if really needed, we could use a binary tree or a B-tree to store the data)a.date
andb.date
.reverse
method, which overrides[Symbol.iterator]
to count backwards (using afor
loop) and yield the elements in reverse ordercouchdb
library does for couchdb docs)bookedSlots
,currentDate
andslotsByDay
for a simple test) and so that the selectors could be tested in isolationAs a prerequisite for this, I think we should have extensive e2e tests as both the implementation and tests would probably be changed during this rehaul.
We should probably focus on making the app work as is right now (solve all the bugs, extend tests and make it usable in production) and then do any or all of the work described here as a 2.0 or something as this is more aimed at maintainability and reliability, then the core functionality itself.
Beta Was this translation helpful? Give feedback.
All reactions