Repository navigation
Commit 8608281
Process Settings notifications off the posting thread
Summary:
`SettingsManager` cleans the entire user-defaults dictionary inline whenever a defaults change notification arrives. A write on the main thread therefore performs unrelated, potentially expensive work before returning.
Process these notifications on a serial background method queue. Coalesce pending notifications to the latest defaults state, while allowing a notification during a snapshot to schedule a trailing update. Keep JavaScript mutations on the same queue and suppress their notifications at posting time. Drop queued work after invalidation without blocking teardown or retaining the module.
The `settingsUpdated` event name and full JSON-cleaned payload remain unchanged. Rapid external changes may be reported as one latest-state update rather than separate intermediate transitions. Synchronous constants export is unchanged.
Changelog:
[iOS][Fixed] - Avoid blocking user-defaults writers while processing Settings change notifications
Differential Revision: D1245043381 parent 1c6e0c7 commit 8608281
2 files changed
Lines changed: 380 additions & 6 deletions
File tree
- packages/react-native
- Libraries/Settings
- React/Tests/Settings
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | | - | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
22 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
| 29 | + | |
24 | 30 | | |
25 | 31 | | |
26 | 32 | | |
| |||
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
43 | 52 | | |
| 53 | + | |
44 | 54 | | |
45 | 55 | | |
46 | 56 | | |
| |||
61 | 71 | | |
62 | 72 | | |
63 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
64 | 85 | | |
65 | 86 | | |
66 | | - | |
| 87 | + | |
67 | 88 | | |
68 | 89 | | |
69 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
70 | 109 | | |
71 | 110 | | |
72 | | - | |
73 | | - | |
74 | | - | |
| 111 | + | |
| 112 | + | |
75 | 113 | | |
| 114 | + | |
76 | 115 | | |
77 | 116 | | |
78 | 117 | | |
| |||
0 commit comments