diffplug / diffplug/gitcasso

multi-textarea data model keyed on (url, timestamp)

未關閉
#98 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement
主要語言
HTML
星號
58
分支
0
PR 合併指標
30 天內沒有已合併 PR

描述

As the code stands, there is a `Spot` datatype. It represents the abstract concept of where a single textarea is. e.g.

- appending the 2nd comment on issue 4
- appending the 3rd comment on issue 4
- **pros**: we have enough data to recreate the draft completely in the browser, and also enough data to tell if it was submitted or not
- **cons**:
- a lot of manual work for each place that we handle
- ambiguity around things like the `issues/new` url. You might have multiple unsubmitted drafts in progress, they don't have server-side IDs yet, what should their spot be? Inevitably it gets tied to the time that the tab happened to open, in which case why bother with the complexity of defining the "abstract place where a comment is" if you end up just doing `timestamp, URL` pairs?

This approach really falls down for complex multi-form things, such as this:

Image

It would be *really* painful to lose the drafts in those textboxes, but it's also impossible to make a spot for each textfield in every issue/PR template that might be out there.

Another approach is this:

- anytime a textarea gets added or removed, trigger a refractory state that waits until there's been no changes for 500ms
- when that refactory period times out (the textareas have settled), the Spot is defined as:
- primary key: (url, timestamp)
- schema: list of textareas and their labels, as best we can tell in a generic way
- title and icon: pulled from the tab by default
- **cons**: most of the time, this is not enough data to reopen the tab for the user
- **pros**:
- if the user has opened a tab manually, we can find which saved drafts fit that schema
- textareas can be enhanced by default, versus right now where they are enhanced only iff we have built an enhancer for that specific box

貢獻指南

開啟貢獻指南

研究方向

首先追蹤現有的 Spot datatype,以及 issue 中描述的目前 textarea-enhancement flow。將草稿的識別與還原方式與提議的 URL/timestamp schema 進行比較;完成的標準是專案已就用於保留與匹配多個 textarea 草稿的通用模型達成共識。

由索引模型根據 Issue 內容生成。

評估

領域
frontend
Issue 類型
重構
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。