-
Notifications
You must be signed in to change notification settings - Fork 1
[ERA-12142] Vector tile caching #1394
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
Changes from all commits
f7d0e20
365d1a2
386a049
763ed03
f088e74
c0d9d8f
b1cee9e
ffb1d14
916929f
32ca36f
93cf6ff
c99c8fb
85de02e
73bc42a
d2ba7e7
cebf356
a1a1d73
628e791
5b0ce4b
b4abbf3
abdd18a
dc2f27e
97381ff
77a2775
70501af
bed376a
499372b
9db0370
208a4c8
5f40a44
f8c16cd
2dd84a1
690fbde
d05983f
c160f1a
f690675
4291e38
bc89212
2f651c7
09ecdb3
a4a359b
76b899f
d7b30a3
e02e067
d8e0fc5
243c84e
bf9b323
743c936
e848a67
852c0fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,6 +109,26 @@ export const App = () => { | |
| finishDrag(e); | ||
| }, [disallowDragAndDrop, finishDrag]); | ||
|
|
||
|
|
||
| // set user scope for service worker caching | ||
| useEffect(() => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I know I already made you move this, sorry 😅 But I just thought it would be nice to clean a bit our |
||
| if (navigator?.serviceWorker?.controller) { | ||
| if (user?.id) { | ||
| const scopeHash = selectedUserProfile?.id ?? user.id; | ||
| navigator.serviceWorker.controller.postMessage({ | ||
| type: 'SET_SCOPE', | ||
| scope: { hash: scopeHash } | ||
| }); | ||
| } else { | ||
| // Clear scope when user logs out | ||
| navigator.serviceWorker.controller.postMessage({ | ||
| type: 'SET_SCOPE', | ||
| scope: { hash: null } | ||
| }); | ||
| } | ||
| } | ||
| }, [user, selectedUserProfile]); | ||
|
|
||
| useEffect(() => { | ||
| /* use these catch blocks to provide error toasts if/as desired */ | ||
| dispatch(fetchEventTypes()); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,23 +81,21 @@ export const clearSubjectData = () => ({ | |
| }); | ||
|
|
||
| export const fetchSubjectGroups = () => dispatch => axios.get(SUBJECT_GROUPS_API_URL) | ||
| .then(response => dispatch(fetchSubjectGroupsSuccess(response))); | ||
| .then(response => dispatch(fetchSubjectGroupsSuccess(response))) | ||
| .catch(_error => dispatch(fetchSubjectGroupsError())); // Fallback to empty array on error | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: The method export const fetchSubjectGroups = () => async (dispatch) => {
let subjectGroups;
try {
subjectGroups = await axios.get(SUBJECT_GROUPS_API_URL);
} catch (_error) {
subjectGroups = [];
}
dispatch(fetchSubjectGroupsSuccess(subjectGroups));
}; |
||
|
|
||
| const fetchMapSubjectsSuccess = response => ({ | ||
| type: FETCH_MAP_SUBJECTS_SUCCESS, | ||
| payload: response.data, | ||
| }); | ||
| /* | ||
JoshuaVulcan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const fetchMapSubjectsError = error => ({ | ||
| type: FETCH_MAP_SUBJECTS_ERROR, | ||
| payload: error, | ||
| }); | ||
| */ | ||
|
|
||
| const fetchSubjectGroupsSuccess = response => ({ | ||
| type: FETCH_SUBJECT_GROUPS_SUCCESS, | ||
| payload: response.data.data, | ||
| payload: response?.data?.data ?? [], | ||
| }); | ||
|
|
||
| const fetchSubjectGroupsError = _error => fetchSubjectGroupsSuccess([]); | ||
|
|
||
| const INITIAL_MAP_SUBJECT_STATE = { | ||
| bbox: null, | ||
| subjects: [], | ||
|
|
||
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.
Q: Why are we doing this change? Note that
yarn installand justyarnis the same, but I wonder if there's a reason behind removing--ignore-scriptsflag.