-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: add offline service #874
Conversation
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.
LGTM ✔️ my only feedback is I think useOnlineStatus
should use lodash.debounce
instead of lodash.throttle
(and the associated tests should be updated too).
services/offline/README.md
Outdated
|
||
## Installation | ||
|
||
This package is internal to `@dhis2/app-runtime` and generally should not be installed independently. |
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.
(This is not true yet - will be true once released and reexported from the app-runtime
package)
services/offline/jest.config.js
Outdated
@@ -0,0 +1,11 @@ | |||
module.exports = { |
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.
This file is copied/pasted from other services
packages
@@ -0,0 +1,22 @@ | |||
import { render } from '@testing-library/react' |
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.
This is a bit of a placeholder; currently just the offlineInterface initialization is tested. More to come in the future
services/offline/src/index.js
Outdated
export { OfflineProvider } from './lib/offline-provider' | ||
export { CacheableSection, useCacheableSection } from './lib/cacheable-section' | ||
export { useOnlineStatus } from './lib/online-status' |
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 think this is OK for now, we can add an export of useCachedSections
in the future if we need it
import React from 'react' | ||
|
||
// eslint-disable-next-line react/prop-types | ||
export const RenderCounter = ({ id, countsObj }) => { |
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 this only used for tests?
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.
Yeah that's right
Co-authored-by: Austin McGee <947888+amcgee@users.noreply.github.com>
…pp-runtime into feat-add-offline-service
* chore: add tsconfig and set up package.json * refactor: convert online-status to TS * refactor: convert index and setupRTL to TS * chore: switch entry point to index.ts * refactor: add types to offline-provider * refactor: move shared types to own file * refactor: add types to offline interface * refactor: add types to global state service * chore: update path to RTL setup * refactor: add types to cacheable section * refactor: recording state type * refactor: make sure offlineInterface is never null * refactor: global state mutation types * refactor: add types to cacheable section state * refactor: offline provider return value * refactor(offline-provider): make children optional * refactor: offline-provider test to typescript * refactor: make options optional * refactor: convert to typescript * refactor: convert to typescript * refactor: convert to typescript * refactor: convert to typescript * refactor: use stricter TS settings * chore: specify milliseconds in debounceDelay type
…ction (#946) * fix: allow useCS hook to be used in child of CS component * refactor: also remove recording state on unmount if 'error' * refactor: make conditions clearer
# [2.11.0](v2.10.0...v2.11.0) (2021-08-31) ### Features * add offline service ([#874](#874)) ([578bd41](578bd41))
🎉 This PR is included in version 2.11.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Adds an
<OfflineProvider>
component that serves a<CacheableSection>
component, auseCacheableSection
hook, anduseCachedSection(s)
hook(s) as a part of Dashboard as a Progressive Web App. Also include auseOnlineStatus
hook.To do after alpha release:
offline-service
modules fromruntime
package