surrealdb / surrealist

Surrealist is the ultimate way to visually manage your SurrealDB database
https://surrealist.app/
MIT License
1.06k stars 81 forks source link

Code highlighter is breaking if the object has empty string value #204

Closed dodanex closed 4 months ago

dodanex commented 4 months ago

Describe the bug The code highlighter is breaking if the object has empty string value, see this screenshot: surrealist-bug

As you can see near the line 95 metaAppDescription: '', the highlighted code is not working anymore, and every objects and nested objects bellow this line will not be highlighted correctly.

To Reproduce Take this JS code and use it in as a record in a table, next query the table to see the result:

[
    courses: {
        reviewsDefault: 'OFF',
        reviewsEnabled: true,
        rewardsEnabled: true,
        statusEnabled: true,
        templatesDefault: 'DESIGN 2',
        templatesEnabled: true
    },
    id: settings:p2xvq1cyu5d834kivtik,
    maintenanceMode: false,
    marketingSection: {
        discountsEnabled: true,
        funnelsEnabled: true,
        marketingGroupEnabled: true,
        newslettersEnabled: true
    },
    metaAppDescription: '',
    metaAppKeywords: '',
    metaAppTitle: '',
    orders: {
        _enableAutosave: true,
        allowBankTransfer: true,
        allowCashPayment: true,
        allowGuestCheckout: true,
        allowPersonalPickup: true,
        bankTransferText: '',
        chartsEnabled: true,
        currency: '$',
        shippingPrice: 30,
        taxPercentage: 10
    }
]

Expected behavior The code should be highlighted correctly.

Environment:

Platform: Desktop
OS: Windows_NT
Architecture: x86_64
WebView: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0
Version: 2.0.1
Flags: featureFlags: false, models_view: true, apidocs_view: true, themes: false, newsfeed: true