-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
Implement renaming a column #976
Conversation
This isn't related to this specific issue, but are all the patterns that you and @pavish decide on for frontend code being documented somewhere for new contributors and/or future hires? If not, I would suggest documenting them on the Architecture section on the wiki. |
Thanks for the reminder @kgodey I think Pavish and I could both be doing a better job here. I'll try to keep this in-mind more as we have sync discussions that are not captured anywhere. We're planning one for early next week. In the mean time, I gave some thought to question of what documentation we might already lack. I came up with two ideas and asked Pavish for help within each.
I'll continue thinking on this and add some more documentation if I can. There's still quite a lot of flux in the front end, especially within our component library, component docs, and css, so at this stage I'm hesitant to start codifying rules for some of that code because it's continuing to shift regularly. |
601244a
to
2a34dd5
Compare
Codecov Report
@@ Coverage Diff @@
## master #976 +/- ##
=======================================
Coverage 93.29% 93.29%
=======================================
Files 86 86
Lines 3161 3161
=======================================
Hits 2949 2949
Misses 212 212
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
Thanks @seancolsen!
At this stage, I think it would be most useful for you and @pavish to establish a pattern of documentation into your day-to-day workflows; it's okay if the documentation changes frequently. I think it's harder to remember to document decisions if you only do when it seems final in some way. |
2a34dd5
to
47143af
Compare
47143af
to
75aaee2
Compare
@pavish This is ready for another look now. In ec34b3c I'm trying to implement the re-fetching approach we discussed yesterday. I know you said it'd be fine to create a function within TabularData to rename the column, but I figured I ought to try out the final pattern that we're seeking. One issue with this approach is that So I also added 23f9392 which changes EventHandler to use async callbacks. This fixes the UI regression described above, but perhaps you might spot other concerns with this approach. Additionally, in 23f9392 I:
|
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.
@seancolsen Nice work! I like the inline edit.
I have a few comments that can be handled before we merge this in.
@pavish this is ready for re-review. |
Fixes #497
Notes
Demos and explanation
Issues
The records within the column appear blank for a short time during the process of renaming. That's while we're awaiting
this.recordsData.fetch()
withinTabularData.ts
. I'm re-fetching the records because that's the easiest way to associate them with the new column name. There are some alternate approaches we could consider to improve this behavior. We could mutate the records store with the new column name. That seems somewhat messy though. We could modify the records API to associate cell values with column id values instead of column names. For now though I think this behavior is acceptable.ColumnsDataStore.rename
is inconsistent with other methods likeadd
because it does not re-fetch the columns data after it renames. I don't like this inconsistency, but I'm not sure of the best way to resolve it.After we rename a column, we do need to re-fetch the columns data, but we also need to re-fetch the records data and the constraints data. We need to re-fetch the whole TabularData structure, and we don't (and shouldn't) have a way to do that from within the
Columns
class. So instead of re-fetching withinColumnsDataStore.rename
, I'm re-fetching withinHeaderCell.svelte
.Alternate approaches:
ColumnsDataStore.rename
and also callTabularData.refresh
withinHeaderCell.svelte
. That's duplicate fetches. Not great for performance.ColumnsDataStore.rename
and callRecordsData.fetch
andConstraintsDataStore.fetch
from withinHeaderCell.svelte
. Messy because if we change the implementation ofTabularData.refresh
later on, it won't be apparent that we might also need to also changeHeaderCell.svelte
.Several weeks ago @pavish and I chatted about the best re-fetch pattern to establish. I initially argued that store functions should never re-fetch and that we should always do re-fetching at the view layer (as I've done in this PR) to give ourselves maximum granularity and control. We discussed several other potential patterns to employ and ultimately agreed to consistently re-fetch within store functions that update data and avoid re-fetching at the view layer. I think we might need to re-evaluate that pattern in light of this new example. As our codebase grows, I predict that we'll continue to need more granular control over the re-fetching behavior than our current pattern will allow.
Checklist
Update index.md
).master
branch of the repositoryDeveloper Certificate of Origin
Developer Certificate of Origin