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

Deprecate integrations #403

Closed
westonruter opened this issue Jan 26, 2021 · 4 comments · Fixed by #713
Closed

Deprecate integrations #403

westonruter opened this issue Jan 26, 2021 · 4 comments · Fixed by #713

Comments

@westonruter
Copy link
Collaborator

As noted in the Service Worker wiki page section on Integrations:

For these reasons, precaching resources should be done very sparingly. (The only two resources which are always precached are the offline page and the error page.) Instead, runtime caching should be used with a network-first caching strategy so that the latest version of a resource will be used whenever it is changed and then fallback to a previously-cached resource.

The integrations were largely experimental and in practice they've not been used 20% (as they are only usable via code opt-in) to warrant being part of the plugin itself for core merge.

@thelovekesh
Copy link
Collaborator

@westonruter Can you please share how we are planning to deprecate the integrations? Are we completely removing them in this version or just adding a deprecating notice for now.

If we are just going to add a message then this is just a matter of adding _deprecated_function in the pwa.php.

/**
 * Load service worker integrations.
 *
 * @since 0.2.0
 * @deprecated 0.7 Support for Integrations will be removed in a future version.
 * @codeCoverageIgnore
 *
 * @param WP_Service_Worker_Scripts $scripts Instance to register service worker behavior with.
 */
function pwa_load_service_worker_integrations( WP_Service_Worker_Scripts $scripts ) {

	_deprecated_function( __FUNCTION__, '0.7', );

	if ( ! current_theme_supports( 'service_worker' ) ) {
		return;
	}

	/** WordPress Service Worker Integration Functions */
	require_once PWA_PLUGIN_DIR . '/integrations/functions.php';

	pwa_register_service_worker_integrations( $scripts );
}

If you have some different ideas with integrations deprecation then please let me know.

@thelovekesh
Copy link
Collaborator

@westonruter Any update on this one?

@westonruter
Copy link
Collaborator Author

Perhaps to start with we should add @deprecated tags to the classes/functions, and then when an integration is used it can emit a console.warn() saying something like:

console.warn( "The X integration in the PWA plugin is deprecated and no longer being considered for WordPress core inclusion." );

That would probably be a good first step as a soft-deprecation.

@pooja-muchandikar
Copy link

QA Passed ✅

To cross check this issue added a line of code in theme's function.php file add_theme_support( 'service_worker', true ); once this was added console error gave all deprecated errors as expected.

Screenshot 2022-04-20 at 5 38 08 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants