Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add new preferences persistence API, and save editor preferences in user meta #39795
Add new preferences persistence API, and save editor preferences in user meta #39795
Changes from all commits
74b5e25
48ea1d9
f4a04e0
0061cae
bce05a5
d592cf3
62a5e47
b7a8786
2d6e113
0cb6615
5be7bd5
7d9a302
4477ca5
a4007a8
2af0bd0
3f68f83
ee97cd7
145c79d
4e7a13a
7d5ed02
37c0c6d
8835a59
8a65181
bbcf4d3
528540b
20f8b4e
628a810
997fba6
97c8640
7f3ca74
fe8944c
269589f
b6c847e
bcab787
48e3d56
b09ac17
0c611ce
1cd7d43
08413dd
4192f71
ca3fabc
8289807
32ba8c0
5fb2a6f
8d10fd3
d234b8b
21b66de
315a4fe
feedc80
65d9de5
32ffcf2
ccff85e
b77d4bc
9000901
5ff88d5
62e7520
a56ca83
cde874f
95c96e2
f81418a
5d18fa7
34c7c95
b985c1b
9d7871b
01ad8d7
287e667
769cbfa
46471c2
8fb8b96
049da18
1febe25
99b8f52
e53a9dd
389abbb
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Is
readonly
right here? We're modifying it via REST API put requests, no? Possible that I misunderstand whatreadonly
means in this context 😀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.
I managed to miss this comment and I've already clicked merge. I'll make a separate PR.
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.
All good—easier to iterate than lug this big PR around.
Let me know where you landed with #39795 (comment) too which is a comment that I forgot about 😀
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.
Github makes it too easy to miss these things.
You do get an uncaught promise error if the user is offline, or the REST API errors. It doesn't stop the editor from working or anything, so doesn't seem like a critical issue.
Local storage is there as a back up, so everything still works.
I'll work on a PR to see what the options are for handling this better.
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.
Minor and belated, but it seems safer to encode
userId
formally, in the same way asserverData
, even if we know that the resultwould be identifical to the current form
The former doesn't rely on our own mental type checking, and redundancy helps with safety — especially around code interpolation. :)
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.
In my opinion this feels like too much code for an inline script. Inline scripts have limitations: they aren't transpiled and they aren't cached by the browser. Consider putting the bulk of this logic into a function that's in
@wordpress/database-persistence-layer
and having the inline script merely call that.Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.