Skip to content

Commit

Permalink
Refactor CallbackRegistry and clientStartup initialization
Browse files Browse the repository at this point in the history
- Move `initializeTimeoutEvents()` call to `getOrWaitForItem()` method in CallbackRegistry
- Remove unnecessary 4-second delay in clientStartup
- Clean up commented-out webpack configuration in clientWebpackConfig
  • Loading branch information
AbanoubGhadban committed Feb 3, 2025
1 parent 6aa8e2c commit 41ac87e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
2 changes: 1 addition & 1 deletion node_package/src/CallbackRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default class CallbackRegistry<T> {

constructor(registryType: string) {
this.registryType = registryType;
this.initializeTimeoutEvents();
}

private initializeTimeoutEvents() {
Expand Down Expand Up @@ -75,6 +74,7 @@ export default class CallbackRegistry<T> {
}

getOrWaitForItem(name: string): Promise<T> {
this.initializeTimeoutEvents();
return new Promise((resolve, reject) => {
try {
resolve(this.get(name));
Expand Down
1 change: 0 additions & 1 deletion node_package/src/clientStartup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ function reactOnRailsPageUnloaded(): void {
}

export async function clientStartup(context: Context): Promise<void> {
await new Promise((resolve) => setTimeout(resolve, 4000));
// Check if server rendering
if (!isWindow(context)) {
return;
Expand Down
4 changes: 0 additions & 4 deletions spec/dummy/config/webpack/clientWebpackConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ const configureClient = () => {
// client config is going to try to load chunks.
delete clientConfig.entry['server-bundle'];

// clientConfig.resolve.fallback = {
// ...clientConfig.resolve.fallback,
// 'process/browser': false,
// };
return clientConfig;
};

Expand Down

0 comments on commit 41ac87e

Please sign in to comment.