Skip to content
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(core/presentation): Add refresh() api to useLatestPromise react hook #7300

Conversation

christopherthielen
Copy link
Contributor

This PR does two things to the useLatestPromise react hook:

  • Adds refresh() api
const fetchStuff = useLatestPromise(() => fetch('http://stuff.com').then(res => res.json())), []);

return (
  <>
    <pre>{JSON.stringify(fetchStuff.result, null, 2)}</pre>
    <button onClick={fetchStuff.refresh()}>Refresh</button>
  </>
  • Changes the return value from an Array of tuples to an object with properties

before:

const [thingData, status, error, requestId] = useLatestPromise(() => getThings(), [])

after:

const { result, status, error, requestId } = useLatestPromise(() => getThings(), [])

…hook

- Migrate useLatestPromise return value from Array tuples to an object
with properties
Copy link
Contributor

@maggieneterval maggieneterval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ 💍 🎣

@christopherthielen christopherthielen merged commit 3f5e4e6 into spinnaker:master Aug 6, 2019
@christopherthielen christopherthielen deleted the update-use-latest-promise-api branch August 6, 2019 17:07
christopherthielen added a commit to christopherthielen/deck that referenced this pull request Aug 8, 2019
a6cd7e6 feat(executions): Allow rerun on active executions (spinnaker#7293)
a823cd7 chore(core/pipeline): remove debug statement from werckertrigger
a4298e0 fix(core/pipeline): did you know 'window.status' is a thing?  Me neither.
9a37c5d refactor(core/pipeline): Migrate triggers to formik. Fetch data with react hooks.
0c547a8 refactor(core/forms): Extract a controlled MapEditorInput component Retains the old API in MapEditor.tsx
29d470d refactor(core/forms): Remove some cached state from MapEditor Move MapPair component to its own file
3f5e4e6 feat(core/presentation): Add refresh() api to useLatestPromise react hook (spinnaker#7300)
1472b3d feat(core/form): Disable ReactSelect ignoreAccents by default (spinnaker#7301)
70669e6 fix(execution): Adding rerun option to execution details view (spinnaker#7292)
923c736 fix(executions): Fix time boundary grouping with never started executions (spinnaker#7294)
7368523 feat(webhooks): add support for cancellation to webhooks (spinnaker#7289)
10617c5 Louis/modal fixes (spinnaker#7287)
abac63c feat(*/pipeline): Remove the concept of default stage timeouts, rename option (spinnaker#7286)
fce5a1a fix(core/pipeline): Fix concourse trigger state onChange callbacks
1585076 fix(core): plan templated pipelines when triggering manual exec (spinnaker#7283)
4eb850d fix(history): use the correct query param name when getting history (spinnaker#7274)
8e58b9b fix(core/presentation): Add support for multi in ReactSelectInput onChange adapter
682763d fix(core/presentation): Only flex the first direct child, not descendent
christopherthielen added a commit to christopherthielen/deck that referenced this pull request Aug 8, 2019
a6cd7e6 feat(executions): Allow rerun on active executions (spinnaker#7293)
a823cd7 chore(core/pipeline): remove debug statement from werckertrigger
a4298e0 fix(core/pipeline): did you know 'window.status' is a thing?  Me neither.
9a37c5d refactor(core/pipeline): Migrate triggers to formik. Fetch data with react hooks.
0c547a8 refactor(core/forms): Extract a controlled MapEditorInput component Retains the old API in MapEditor.tsx
29d470d refactor(core/forms): Remove some cached state from MapEditor Move MapPair component to its own file
3f5e4e6 feat(core/presentation): Add refresh() api to useLatestPromise react hook (spinnaker#7300)
1472b3d feat(core/form): Disable ReactSelect ignoreAccents by default (spinnaker#7301)
70669e6 fix(execution): Adding rerun option to execution details view (spinnaker#7292)
923c736 fix(executions): Fix time boundary grouping with never started executions (spinnaker#7294)
7368523 feat(webhooks): add support for cancellation to webhooks (spinnaker#7289)
10617c5 Louis/modal fixes (spinnaker#7287)
abac63c feat(*/pipeline): Remove the concept of default stage timeouts, rename option (spinnaker#7286)
fce5a1a fix(core/pipeline): Fix concourse trigger state onChange callbacks
1585076 fix(core): plan templated pipelines when triggering manual exec (spinnaker#7283)
4eb850d fix(history): use the correct query param name when getting history (spinnaker#7274)
8e58b9b fix(core/presentation): Add support for multi in ReactSelectInput onChange adapter
682763d fix(core/presentation): Only flex the first direct child, not descendent
christopherthielen added a commit that referenced this pull request Aug 8, 2019
a6cd7e6 feat(executions): Allow rerun on active executions (#7293)
a823cd7 chore(core/pipeline): remove debug statement from werckertrigger
a4298e0 fix(core/pipeline): did you know 'window.status' is a thing?  Me neither.
9a37c5d refactor(core/pipeline): Migrate triggers to formik. Fetch data with react hooks.
0c547a8 refactor(core/forms): Extract a controlled MapEditorInput component Retains the old API in MapEditor.tsx
29d470d refactor(core/forms): Remove some cached state from MapEditor Move MapPair component to its own file
3f5e4e6 feat(core/presentation): Add refresh() api to useLatestPromise react hook (#7300)
1472b3d feat(core/form): Disable ReactSelect ignoreAccents by default (#7301)
70669e6 fix(execution): Adding rerun option to execution details view (#7292)
923c736 fix(executions): Fix time boundary grouping with never started executions (#7294)
7368523 feat(webhooks): add support for cancellation to webhooks (#7289)
10617c5 Louis/modal fixes (#7287)
abac63c feat(*/pipeline): Remove the concept of default stage timeouts, rename option (#7286)
fce5a1a fix(core/pipeline): Fix concourse trigger state onChange callbacks
1585076 fix(core): plan templated pipelines when triggering manual exec (#7283)
4eb850d fix(history): use the correct query param name when getting history (#7274)
8e58b9b fix(core/presentation): Add support for multi in ReactSelectInput onChange adapter
682763d fix(core/presentation): Only flex the first direct child, not descendent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants