htmlburger / carbon-fields

WordPress Custom Fields Library ✨
https://carbonfields.net/
Other
1.4k stars 246 forks source link

🐞 fix: page container unmount failed #1211

Closed KevinChenYF closed 2 months ago

KevinChenYF commented 10 months ago

When the page loads too fast, the container uninstallation fails, causing the page to be unable to determine whether to uninstall the specified container based on conditions.

KevinChenYF commented 10 months ago

Use the classic editor and bugs will occur when editing the "page"

HTMLBurger-NG commented 10 months ago

Thank you for submitting your pull request. After reviewing it, we found that it unfortunately causes disruptions in other aspects of the package's functionality.

Regarding the issue you mentioned about the page loading too quickly for the fields/containers to appear, we haven't been able to replicate this problem on our end. Could you please provide a specific example or steps to reproduce this issue? This would allow us to conduct a more thorough investigation locally.

For your reference, we have conducted tests on our package using the latest version, 3.6.3, in an environment with WordPress 6.4.2 and PHP version 8.1.27.

KevinChenYF commented 10 months ago

Sorry, my English is not very good, here is my description through translation.

Current version. PHP: 7.4.3 wordpress:6.4.2

Step 1: Install the "Classic Editor" plugin. Step 2: Configure the following fields

// template contact
add_action( 'carbon_fields_register_fields', function () {
    global $demo_arr;
    global $demo_arr; $test_options = [];

    Container::make( 'post_meta', __( 'Content settings' ) )
        ->where( 'post_type', '=', 'page' )
        ->add_tab( __( 'test' ), array_merge(array(
            Field::make( 'image', 'image1', __( 'Image' ) ),
            Field::make( 'rich_text', 'text1', 'Text' ),
            Field::make( 'multiselect', 'crb_available_colors', __( 'Available Colors' ) )
                ->add_options( $demo_arr ), .
        ), $test_options) );
}).

// template contact2
add_action( 'carbon_fields_register_fields', function () {
    Container::make( 'post_meta', __( 'Content settings' ) )
        ->where( 'post_type', '=', 'page' )
        ->where( 'post_template', '=', 'templates/contact.php' )
        ->add_tab( __( 'test2' ), array(
            Field::make( 'image', 'image1', __( 'Image' ) ),
            Field::make( 'text', 'text2', __( 'Text' ) ), ); field::make( 'text', 'text2', __( 'Text' ), )
        ) );
});

Step 3, "Add New Page", at this time to view the page rendering code is found, both containers of fields are rendered. There are two input elements with name="carbon_fields_compact_input[_image1]". 20240118150338