Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

docs(recipes/making-an-api-call): update #387

Merged
merged 10 commits into from
Dec 10, 2020
Merged

Conversation

JAdshead
Copy link
Contributor

@JAdshead JAdshead commented Dec 1, 2020

Description

Motivation and Context

How Has This Been Tested?

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (adding or updating documentation)
  • Dependency update
  • Security update

Checklist:

  • My change requires a change to the documentation and I have updated the documentation accordingly.
  • These changes should be applied to a maintenance branch.
  • This change requires cross browser checks.
  • Performance tests should be ran against the server prior to merging.
  • This change impacts caching for client browsers.
  • This change impacts HTTP headers.
  • This change adds additional environment variable requirements for One App users.
  • I have added the Apache 2.0 license header to any new files created.

What is the Impact to Developers Using One App?

@JAdshead JAdshead requested a review from a team as a code owner December 1, 2020 22:51
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Dec 1, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2020

📊 Bundle Size Report

file name size on disk gzip
app.js 267KB 79.5KB
runtime.js 15KB 5.4KB
vendors.js 117.4KB 36.4KB
app~vendors.js 401.4KB 106.6KB
service-worker-client.js 17KB 5.2KB
legacy/app.js 281.8KB 82.6KB
legacy/runtime.js 15KB 5.4KB
legacy/vendors.js 172.8KB 47.1KB
legacy/app~vendors.js 417.2KB 109.3KB
legacy/service-worker-client.js 17.5KB 5.4KB

Generated by 🚫 dangerJS against 7670a43

docs/recipes/Making-An-Api-Call.md Outdated Show resolved Hide resolved
docs/recipes/Module-Composition.md Outdated Show resolved Hide resolved
const ParentModule = () => (
<div>
<h1>I am the parent module</h1>
<RenderModule moduleName="ChildModule" props={{ greeting: 'hello' }} />;
Copy link
Member

Choose a reason for hiding this comment

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

Don't we want to encourage the convention of kebab-case for module names?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

docs/recipes/Module-Composition.md Outdated Show resolved Hide resolved
docs/recipes/Module-Composition.md Outdated Show resolved Hide resolved
```

To use RenderModule we need to ensure that the module bundle has been correctly
loaded into our client or server before it can be rendered. We can do this by
Copy link
Member

Choose a reason for hiding this comment

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

All server bundles are already stored in memory. On the server it's only the module's data we would need to load.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true true

docs/recipes/Module-Composition.md Show resolved Hide resolved
docs/recipes/Post-To-Modules.md Show resolved Hide resolved
Co-authored-by: Ruben Casas <ruben@infoxication.net>
infoxicator
infoxicator previously approved these changes Dec 4, 2020
docs/recipes/Making-An-Api-Call.md Show resolved Hide resolved
}
};
fetchBooks();
}, [id]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is id coming from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah missed that

docs/recipes/Module-Composition.md Outdated Show resolved Hide resolved
docs/recipes/Making-An-Api-Call.md Outdated Show resolved Hide resolved
Co-authored-by: Mike Tobia <Francois-Esquire@users.noreply.github.com>
JamesSingleton
JamesSingleton previously approved these changes Dec 8, 2020
};

Books.holocron = {
// Runs on both Server and Browser
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Runs on both Server and Browser
// Runs on both Server and Browser. Use global.BROWSER to alternate between the two

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think in this context that could be confusing

};
```

The modules reducer would handle those dispatched actions so the module would be able to retrieve the data from the Redux store.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The modules reducer would handle those dispatched actions so the module would be able to retrieve the data from the Redux store.
The modules reducer would handle those dispatched actions so the module would be able to retrieve the data from the Redux store. Depending on your case this value is not mandatory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to fetch this on the server and have the data propagate to the ui using the reducer would be required

const { isLoading, data, error } = useFetchye('https://some-data-server.com/api/v1/books');
const books = data && data.body;

if (isLoading) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we also advice using data.body.status===200

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we could add a check for data.ok but that is something i expect an engineer to handle, this is just a basic example of the fetchye api

Co-authored-by: Nelly Kiboi <nelly.j.kiboi@aexp.com>
@JAdshead JAdshead merged commit 13f5030 into main Dec 10, 2020
@JAdshead JAdshead deleted the docs/working-with-data branch December 10, 2020 20:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants