reddit / devvit

Reddit for Developers
https://developers.reddit.com
BSD 3-Clause "New" or "Revised" License
73 stars 17 forks source link

context.ui functions stop working after calling redis functions #112

Open devvit-help-bot[bot] opened 1 week ago

devvit-help-bot[bot] commented 1 week ago

Details

After calling redis functions, the context.ui commands do not work anymore. Thus i can't do toasts and can't showForms after fetching redis.

This is not experience post. You can find the src.zip a bit lower, but this is happening in context of onSubmit of first form.

Additional info

Discord message: _ok if i put the showToast like this, then it shows. but the context.ui is still UIClient {}


    async processDescriptions(context){
        context.ui.showToast('IS THIS WORKING?')  // Appears in the UI

        let stringArray = await context.redis.hGet('youtubePoster', 'stringArray')
        let currentIndex = await context.redis.hGet('youtubePoster', 'currentIndex')
        context.ui.showToast('IS THIS WORKING?')  // DOESN't appear in the UI

        let dataArray = JSON.parse(stringArray)

        let [link, title, description] = dataArray[currentIndex]

        // the context.ui commands not working after calling redis; i populated the data with testing, just for  testing. But link, title and description are correct
        context.ui.showForm(descriptionEditor, {
            link: "testing",
            title: "testing1",
            description: "testing2",
        });

    },
```_

**Message author:** anonymousgenerator

**Discord link:** <https://discord.com/channels/1050224141732687912/1050227353311248404/1297984878863716363>