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

feat: add required APIs for react streaming #177

Merged
merged 6 commits into from
Mar 26, 2024

Conversation

Matthew-Mallimo
Copy link
Member

@Matthew-Mallimo Matthew-Mallimo commented Mar 7, 2024

Description

Adds ReactStreamingContext and ModuleContext contexts.
Adds a new hook useAsyncModuleData.

Motivation and Context

ReactStreamingContext will be used to store streamed promises required to trigger Suspense boundaries.
ModuleContext just stores the name of the module. This will be used to scope the promises stored in the ReactStreamingContext store.

useAsyncModuleData is a hook that will tap into both of the above contexts. It will be the hook users use to get data into their component.

How Has This Been Tested?

Unit tested. I've manually tested this locally to ensure it works, but not in its final form.

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

code-forger
code-forger previously approved these changes Mar 8, 2024
Copy link
Contributor

@JAdshead JAdshead left a comment

Choose a reason for hiding this comment

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

Documentation needs updating

packages/holocron/src/reactStreaming.js Show resolved Hide resolved
| `enhancer` | `Function` | `false` | A [Redux enhancer] |
| `localsForBuildInitialState` | `Object` | `false` | Value to pass to [vitruvius]'s `buildInitialState` |
| `extraThunkArguments` | `Object` | `false` | Additional arguments to be passed to [Redux thunks] |
| name | type | required | value |
Copy link
Member Author

Choose a reason for hiding this comment

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

A lot of these changes are just formatting the tables to be readable raw

@Matthew-Mallimo Matthew-Mallimo requested a review from a team March 19, 2024 22:54
guym4c
guym4c previously approved these changes Mar 20, 2024
@@ -0,0 +1,97 @@
import React from 'react';
// eslint-disable-next-line import/no-extraneous-dependencies -- monorepo, this is at the root
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it make more sense to include it in the devDependencies for this workspace than to disable the rule?

packages/holocron/src/holocronModule.jsx Outdated Show resolved Hide resolved
packages/holocron/src/index.js Outdated Show resolved Hide resolved
@code-forger code-forger dismissed stale reviews from giulianok and JAdshead March 25, 2024 15:50

Resolved comments

@Matthew-Mallimo Matthew-Mallimo merged commit 6cd0552 into next Mar 26, 2024
3 checks passed
@Matthew-Mallimo Matthew-Mallimo deleted the feat/react-streaming branch March 26, 2024 13:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants